summaryrefslogtreecommitdiff
path: root/git/test/lib/helper.py
diff options
context:
space:
mode:
authorAntoine Musso <hashar@free.fr>2014-11-16 20:51:04 +0100
committerAntoine Musso <hashar@free.fr>2014-11-16 20:51:21 +0100
commitbe34ec23c48d6d5d8fd2ef4491981f6fb4bab8e6 (patch)
tree7d0124054760421d95a6f675d8e843e42a72ad82 /git/test/lib/helper.py
parentf5d11b750ecc982541d1f936488248f0b42d75d3 (diff)
downloadgitpython-be34ec23c48d6d5d8fd2ef4491981f6fb4bab8e6.tar.gz
pep8 linting (blank lines expectations)
E301 expected 1 blank line, found 0 E302 expected 2 blank lines, found 1 E303 too many blank lines (n)
Diffstat (limited to 'git/test/lib/helper.py')
-rw-r--r--git/test/lib/helper.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/git/test/lib/helper.py b/git/test/lib/helper.py
index 4f8cdf33..d5045ad7 100644
--- a/git/test/lib/helper.py
+++ b/git/test/lib/helper.py
@@ -21,13 +21,16 @@ __all__ = (
#{ Routines
+
def fixture_path(name):
test_dir = os.path.dirname(os.path.dirname(__file__))
return os.path.join(test_dir, "fixtures", name)
+
def fixture(name):
return open(fixture_path(name), 'rb').read()
+
def absolute_project_path():
return os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))
@@ -35,7 +38,9 @@ def absolute_project_path():
#{ Adapters
+
class StringProcessAdapter(object):
+
"""Allows to use strings as Process object as returned by SubProcess.Popen.
Its tailored to work with the test system only"""
@@ -52,6 +57,7 @@ class StringProcessAdapter(object):
#{ Decorators
+
def _mktemp(*args):
"""Wrapper around default tempfile.mktemp to fix an osx issue"""
tdir = tempfile.mktemp(*args)
@@ -59,6 +65,7 @@ def _mktemp(*args):
tdir = '/private' + tdir
return tdir
+
def _rmtree_onerror(osremove, fullpath, exec_info):
"""
Handle the case on windows that read-only files cannot be deleted by
@@ -70,6 +77,7 @@ def _rmtree_onerror(osremove, fullpath, exec_info):
os.chmod(fullpath, 0777)
os.remove(fullpath)
+
def with_rw_repo(working_tree_ref, bare=False):
"""
Same as with_bare_repo, but clones the rorepo as non-bare repository, checking
@@ -81,6 +89,7 @@ def with_rw_repo(working_tree_ref, bare=False):
dir of the repository.
"""
assert isinstance(working_tree_ref, basestring), "Decorator requires ref name for working tree checkout"
+
def argument_passer(func):
def repo_creator(self):
prefix = 'non_'
@@ -117,6 +126,7 @@ def with_rw_repo(working_tree_ref, bare=False):
# END argument passer
return argument_passer
+
def with_rw_and_rw_remote_repo(working_tree_ref):
"""
Same as with_rw_repo, but also provides a writable remote repository from which the
@@ -141,6 +151,7 @@ def with_rw_and_rw_remote_repo(working_tree_ref):
See working dir info in with_rw_repo
"""
assert isinstance(working_tree_ref, basestring), "Decorator requires ref name for working tree checkout"
+
def argument_passer(func):
def remote_repo_creator(self):
remote_repo_dir = _mktemp("remote_repo_%s" % func.__name__)
@@ -208,7 +219,9 @@ def with_rw_and_rw_remote_repo(working_tree_ref):
#} END decorators
+
class TestBase(TestCase):
+
"""
Base Class providing default functionality to all tests such as: