summaryrefslogtreecommitdiff
path: root/git/test/lib/helper.py
diff options
context:
space:
mode:
Diffstat (limited to 'git/test/lib/helper.py')
-rw-r--r--git/test/lib/helper.py24
1 files changed, 8 insertions, 16 deletions
diff --git a/git/test/lib/helper.py b/git/test/lib/helper.py
index 80d1ae7a..c5a003ea 100644
--- a/git/test/lib/helper.py
+++ b/git/test/lib/helper.py
@@ -13,8 +13,9 @@ import tempfile
import textwrap
import time
from unittest import TestCase
+import unittest
-from git.compat import string_types, is_win
+from git.compat import string_types, is_win, PY3
from git.util import rmtree
import os.path as osp
@@ -68,18 +69,6 @@ class StringProcessAdapter(object):
#{ Decorators
-def _mktemp(*args):
- """Wrapper around default tempfile.mktemp to fix an osx issue
- :note: the OSX special case was removed as it was unclear why that was needed in the first place. It seems
- to be just fine without it. However, if we leave this special case, and if TMPDIR is set to something custom,
- prefixing /private/ will lead to incorrect paths on OSX."""
- tdir = tempfile.mktemp(*args)
- # See :note: above to learn why this is comented out.
- # if is_darwin:
- # tdir = '/private' + tdir
- return tdir
-
-
def with_rw_directory(func):
"""Create a temporary directory which can be written to, remove it if the
test succeeds, but leave it otherwise to aid additional debugging"""
@@ -129,7 +118,7 @@ def with_rw_repo(working_tree_ref, bare=False):
if bare:
prefix = ''
# END handle prefix
- repo_dir = _mktemp("%sbare_%s" % (prefix, func.__name__))
+ repo_dir = tempfile.mktemp("%sbare_%s" % (prefix, func.__name__))
rw_repo = self.rorepo.clone(repo_dir, shared=True, bare=bare, n=True)
rw_repo.head.commit = rw_repo.commit(working_tree_ref)
@@ -222,8 +211,8 @@ def with_rw_and_rw_remote_repo(working_tree_ref):
@wraps(func)
def remote_repo_creator(self):
- remote_repo_dir = _mktemp("remote_repo_%s" % func.__name__)
- repo_dir = _mktemp("remote_clone_non_bare_repo")
+ remote_repo_dir = tempfile.mktemp("remote_repo_%s" % func.__name__)
+ repo_dir = tempfile.mktemp("remote_clone_non_bare_repo")
rw_remote_repo = self.rorepo.clone(remote_repo_dir, shared=True, bare=True)
# recursive alternates info ?
@@ -340,6 +329,9 @@ class TestBase(TestCase):
of the project history ( to assure tests don't fail for others ).
"""
+ if not PY3:
+ assertRaisesRegex = unittest.TestCase.assertRaisesRegexp
+
def _small_repo_url(self):
""":return" a path to a small, clonable repository"""
from git.cmd import Git