|
13 | 13 | importtextwrap |
14 | 14 | importtime |
15 | 15 | fromunittestimportTestCase |
| 16 | +importunittest |
16 | 17 |
|
17 | | -fromgit.compatimportstring_types,is_win |
| 18 | +fromgit.compatimportstring_types,is_win,PY3 |
18 | 19 | fromgit.utilimportrmtree |
19 | 20 |
|
20 | 21 | importos.pathasosp |
@@ -68,18 +69,6 @@ def wait(self): |
68 | 69 | #{ Decorators |
69 | 70 |
|
70 | 71 |
|
71 | | -def_mktemp(*args): |
72 | | -"""Wrapper around default tempfile.mktemp to fix an osx issue |
73 | | - :note: the OSX special case was removed as it was unclear why that was needed in the first place. It seems |
74 | | - to be just fine without it. However, if we leave this special case, and if TMPDIR is set to something custom, |
75 | | - prefixing /private/ will lead to incorrect paths on OSX.""" |
76 | | -tdir=tempfile.mktemp(*args) |
77 | | -# See :note: above to learn why this is comented out. |
78 | | -# if is_darwin: |
79 | | -# tdir = '/private' + tdir |
80 | | -returntdir |
81 | | - |
82 | | - |
83 | 72 | defwith_rw_directory(func): |
84 | 73 | """Create a temporary directory which can be written to, remove it if the |
85 | 74 | test succeeds, but leave it otherwise to aid additional debugging""" |
@@ -129,7 +118,7 @@ def repo_creator(self): |
129 | 118 | ifbare: |
130 | 119 | prefix='' |
131 | 120 | # END handle prefix |
132 | | -repo_dir=_mktemp("%sbare_%s"% (prefix,func.__name__)) |
| 121 | +repo_dir=tempfile.mktemp("%sbare_%s"% (prefix,func.__name__)) |
133 | 122 | rw_repo=self.rorepo.clone(repo_dir,shared=True,bare=bare,n=True) |
134 | 123 |
|
135 | 124 | rw_repo.head.commit=rw_repo.commit(working_tree_ref) |
@@ -222,8 +211,8 @@ def argument_passer(func): |
222 | 211 |
|
223 | 212 | @wraps(func) |
224 | 213 | defremote_repo_creator(self): |
225 | | -remote_repo_dir=_mktemp("remote_repo_%s"%func.__name__) |
226 | | -repo_dir=_mktemp("remote_clone_non_bare_repo") |
| 214 | +remote_repo_dir=tempfile.mktemp("remote_repo_%s"%func.__name__) |
| 215 | +repo_dir=tempfile.mktemp("remote_clone_non_bare_repo") |
227 | 216 |
|
228 | 217 | rw_remote_repo=self.rorepo.clone(remote_repo_dir,shared=True,bare=True) |
229 | 218 | # recursive alternates info ? |
@@ -340,6 +329,9 @@ class TestBase(TestCase): |
340 | 329 | of the project history ( to assure tests don't fail for others ). |
341 | 330 | """ |
342 | 331 |
|
| 332 | +ifnotPY3: |
| 333 | +assertRaisesRegex=unittest.TestCase.assertRaisesRegexp |
| 334 | + |
343 | 335 | def_small_repo_url(self): |
344 | 336 | """:return" a path to a small, clonable repository""" |
345 | 337 | fromgit.cmdimportGit |
|