diff options
author | Guido Günther <agx@sigxcpu.org> | 2017-11-06 19:22:03 +0100 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2017-11-06 19:24:07 +0100 |
commit | b1a03534a0bde38a21c844302eff1a0a0bd2e863 (patch) | |
tree | a35f3c37e1c2f6137a01aca0cd81c2a8240cbda9 /tests/testutils | |
parent | 318a4e8dcb2d6030b265b4f331d1fd6739e8f3c7 (diff) |
DebianGitTestRepo: allow to set file mode
This allows us to write binary files as well
Diffstat (limited to 'tests/testutils')
-rw-r--r-- | tests/testutils/debiangittestrepo.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/testutils/debiangittestrepo.py b/tests/testutils/debiangittestrepo.py index c52c5f17..20184525 100644 --- a/tests/testutils/debiangittestrepo.py +++ b/tests/testutils/debiangittestrepo.py @@ -25,7 +25,7 @@ class DebianGitTestRepo(unittest.TestCase): def tearDown(self): context.teardown() - def add_file(self, name, content=None, msg=None): + def add_file(self, name, content=None, msg=None, mode=None): """ Add a single file with name I{name} and content I{content}. If I{content} is C{none} the content of the file is undefined. @@ -41,7 +41,7 @@ class DebianGitTestRepo(unittest.TestCase): if not os.path.exists(d): os.makedirs(d) - with open(path, 'w+') as f: + with open(path, mode or 'w+') as f: content is None or f.write(content) self.repo.add_files(name, force=True) self.repo.commit_files(path, msg or "added %s" % name) |