diff options
Diffstat (limited to 'tests/testutils/repo/git.py')
-rw-r--r-- | tests/testutils/repo/git.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/testutils/repo/git.py b/tests/testutils/repo/git.py index 9d527f904..eea43d608 100644 --- a/tests/testutils/repo/git.py +++ b/tests/testutils/repo/git.py @@ -1,5 +1,7 @@ -import subprocess +import os import pytest +import shutil +import subprocess from .repo import Repo from ..site import HAVE_GIT @@ -36,6 +38,14 @@ class Git(Repo): env=GIT_ENV, cwd=self.repo) return self.latest_commit() + def add_file(self, filename): + shutil.copy(filename, self.repo) + subprocess.call(['git', 'add', os.path.basename(filename)], env=GIT_ENV, cwd=self.repo) + subprocess.call([ + 'git', 'commit', '-m', 'Added {}'.format(os.path.basename(filename)) + ], env=GIT_ENV, cwd=self.repo) + return self.latest_commit() + def add_submodule(self, subdir, url=None, checkout=None): submodule = {} if checkout is not None: |