~bzoltan/click/transition_mirrors

« back to all changes in this revision

Viewing changes to click/tests/helpers.py

  • Committer: CI bot
  • Author(s): Colin Watson
  • Date: 2014-09-29 14:18:29 UTC
  • mfrom: (425.1.104 devel)
  • Revision ID: ps-jenkins@lists.canonical.com-20140929141829-vo7vf415d3f6vkq7
Click 0.4.33: Add scope APIs; fix GC; add "click chroot --name"; make "click destroy" more robust; stop apps when uninstalling them. Fixes: 1324853, 1330770
Approved by: Colin Watson

Show diffs side-by-side

added added

removed removed

Lines of Context:
326
326
def touch(path):
327
327
    with mkfile(path, mode="a"):
328
328
        pass
 
329
 
 
330
 
 
331
def make_file_with_content(filename, content, mode=0o644):
 
332
    """Create a file with the given content and mode"""
 
333
    Click.ensuredir(os.path.dirname(filename))
 
334
    with open(filename, "w") as f:
 
335
        f.write(content)
 
336
    os.chmod(filename, mode)