Skip to content

Commit 74c7ed0

Browse files
committed
FIX gitpython-developers#526: Do not depend on test-sources
+ Move `HIDE_WINDOWS_KNOWN_ERRORS` flag from `git.test.lib.helper-->git.util`; regular modules in main-sources folder also depend on that flag. + Use unittest.SkipTest instead of from non-standard `nose` lib.
1 parent 4e5ef73 commit 74c7ed0

File tree

9 files changed

+17
-17
lines changed

9 files changed

+17
-17
lines changed

Diff for: git/objects/submodule/base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
import logging
4040
import uuid
4141
from unittest.case import SkipTest
42-
from git.test.lib.helper import HIDE_WINDOWS_KNOWN_ERRORS
42+
from git.util import HIDE_WINDOWS_KNOWN_ERRORS
4343
from git.objects.base import IndexObject, Object
4444

4545
__all__ = ["Submodule", "UpdateProgress"]

Diff for: git/test/lib/helper.py

+1-6
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,6 @@
3131

3232
log = logging.getLogger('git.util')
3333

34-
#: We need an easy way to see if Appveyor TCs start failing,
35-
#: so the errors marked with this var are considered "acknowledged" ones, awaiting remedy,
36-
#: till then, we wish to hide them.
37-
HIDE_WINDOWS_KNOWN_ERRORS = is_win and os.environ.get('HIDE_WINDOWS_KNOWN_ERRORS', True)
38-
3934
#{ Routines
4035

4136

@@ -289,7 +284,7 @@ def remote_repo_creator(self):
289284
You can also run the daemon on a different port by passing --port=<port>"
290285
and setting the environment variable GIT_PYTHON_TEST_GIT_DAEMON_PORT to <port>
291286
""" % temp_dir)
292-
from nose import SkipTest
287+
from unittest import SkipTest
293288
raise SkipTest(msg) if is_win else AssertionError(msg)
294289
# END make assertion
295290
# END catch ls remote error

Diff for: git/test/performance/test_odb.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from unittest.case import skipIf
77

88
from git.compat import PY3
9-
from git.test.lib.helper import HIDE_WINDOWS_KNOWN_ERRORS
9+
from git.util import HIDE_WINDOWS_KNOWN_ERRORS
1010

1111
from .lib import (
1212
TestBigRepoR

Diff for: git/test/test_base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def test_add_unicode(self, rw_repo):
128128
try:
129129
file_path.encode(sys.getfilesystemencoding())
130130
except UnicodeEncodeError:
131-
from nose import SkipTest
131+
from unittest import SkipTest
132132
raise SkipTest("Environment doesn't support unicode filenames")
133133

134134
with open(file_path, "wb") as fp:

Diff for: git/test/test_index.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
fixture,
4444
with_rw_repo
4545
)
46-
from git.test.lib.helper import HIDE_WINDOWS_KNOWN_ERRORS
46+
from git.util import HIDE_WINDOWS_KNOWN_ERRORS
4747
from git.test.lib import with_rw_directory
4848
from git.util import Actor, rmtree
4949
from gitdb.base import IStream

Diff for: git/test/test_repo.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@
5050
assert_true,
5151
raises
5252
)
53-
from git.test.lib.helper import HIDE_WINDOWS_KNOWN_ERRORS
53+
from git.util import HIDE_WINDOWS_KNOWN_ERRORS
5454
from git.test.lib import with_rw_directory
5555
from git.util import join_path_native, rmtree, rmfile
5656
from gitdb.util import bin_to_hex
57-
from nose import SkipTest
57+
from unittest import SkipTest
5858

5959
import functools as fnt
6060
import os.path as osp

Diff for: git/test/test_submodule.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
with_rw_repo
2222
)
2323
from git.test.lib import with_rw_directory
24-
from git.test.lib.helper import HIDE_WINDOWS_KNOWN_ERRORS
24+
from git.util import HIDE_WINDOWS_KNOWN_ERRORS
2525
from git.util import to_native_path_linux, join_path_native
2626

2727

Diff for: git/test/test_tree.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
Tree,
1414
Blob
1515
)
16-
from git.test.lib.helper import HIDE_WINDOWS_KNOWN_ERRORS
16+
from git.util import HIDE_WINDOWS_KNOWN_ERRORS
1717
from git.test.lib import TestBase
1818

1919

Diff for: git/util.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from functools import wraps
1818

1919
from git.compat import is_win
20-
from gitdb.util import ( # NOQA
20+
from gitdb.util import (# NOQA
2121
make_sha,
2222
LockedFD, # @UnusedImport
2323
file_contents_ro, # @UnusedImport
@@ -44,7 +44,13 @@
4444
__all__ = ("stream_copy", "join_path", "to_native_path_windows", "to_native_path_linux",
4545
"join_path_native", "Stats", "IndexFileSHA1Writer", "Iterable", "IterableList",
4646
"BlockingLockFile", "LockFile", 'Actor', 'get_user_id', 'assure_directory_exists',
47-
'RemoteProgress', 'CallableRemoteProgress', 'rmtree', 'unbare_repo')
47+
'RemoteProgress', 'CallableRemoteProgress', 'rmtree', 'unbare_repo',
48+
'HIDE_WINDOWS_KNOWN_ERRORS')
49+
50+
#: We need an easy way to see if Appveyor TCs start failing,
51+
#: so the errors marked with this var are considered "acknowledged" ones, awaiting remedy,
52+
#: till then, we wish to hide them.
53+
HIDE_WINDOWS_KNOWN_ERRORS = is_win and os.environ.get('HIDE_WINDOWS_KNOWN_ERRORS', True)
4854

4955
#{ Utility Methods
5056

@@ -76,7 +82,6 @@ def onerror(func, path, exc_info):
7682
try:
7783
func(path) # Will scream if still not possible to delete.
7884
except Exception as ex:
79-
from git.test.lib.helper import HIDE_WINDOWS_KNOWN_ERRORS
8085
if HIDE_WINDOWS_KNOWN_ERRORS:
8186
raise SkipTest("FIXME: fails with: PermissionError\n %s", ex)
8287
else:

0 commit comments

Comments
 (0)