Skip to content

Commit

Permalink
FIX #526: Do not depend on test-sources
Browse files Browse the repository at this point in the history
+ 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.
  • Loading branch information
ankostis committed Oct 11, 2016
1 parent 4e5ef73 commit 74c7ed0
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion git/objects/submodule/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
import logging
import uuid
from unittest.case import SkipTest
from git.test.lib.helper import HIDE_WINDOWS_KNOWN_ERRORS
from git.util import HIDE_WINDOWS_KNOWN_ERRORS
from git.objects.base import IndexObject, Object

__all__ = ["Submodule", "UpdateProgress"]
Expand Down
7 changes: 1 addition & 6 deletions git/test/lib/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@

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

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

#{ Routines


Expand Down Expand Up @@ -289,7 +284,7 @@ def remote_repo_creator(self):
You can also run the daemon on a different port by passing --port=<port>"
and setting the environment variable GIT_PYTHON_TEST_GIT_DAEMON_PORT to <port>
""" % temp_dir)
from nose import SkipTest
from unittest import SkipTest
raise SkipTest(msg) if is_win else AssertionError(msg)
# END make assertion
# END catch ls remote error
Expand Down
2 changes: 1 addition & 1 deletion git/test/performance/test_odb.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from unittest.case import skipIf

from git.compat import PY3
from git.test.lib.helper import HIDE_WINDOWS_KNOWN_ERRORS
from git.util import HIDE_WINDOWS_KNOWN_ERRORS

from .lib import (
TestBigRepoR
Expand Down
2 changes: 1 addition & 1 deletion git/test/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def test_add_unicode(self, rw_repo):
try:
file_path.encode(sys.getfilesystemencoding())
except UnicodeEncodeError:
from nose import SkipTest
from unittest import SkipTest
raise SkipTest("Environment doesn't support unicode filenames")

with open(file_path, "wb") as fp:
Expand Down
2 changes: 1 addition & 1 deletion git/test/test_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
fixture,
with_rw_repo
)
from git.test.lib.helper import HIDE_WINDOWS_KNOWN_ERRORS
from git.util import HIDE_WINDOWS_KNOWN_ERRORS
from git.test.lib import with_rw_directory
from git.util import Actor, rmtree
from gitdb.base import IStream
Expand Down
4 changes: 2 additions & 2 deletions git/test/test_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@
assert_true,
raises
)
from git.test.lib.helper import HIDE_WINDOWS_KNOWN_ERRORS
from git.util import HIDE_WINDOWS_KNOWN_ERRORS
from git.test.lib import with_rw_directory
from git.util import join_path_native, rmtree, rmfile
from gitdb.util import bin_to_hex
from nose import SkipTest
from unittest import SkipTest

import functools as fnt
import os.path as osp
Expand Down
2 changes: 1 addition & 1 deletion git/test/test_submodule.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
with_rw_repo
)
from git.test.lib import with_rw_directory
from git.test.lib.helper import HIDE_WINDOWS_KNOWN_ERRORS
from git.util import HIDE_WINDOWS_KNOWN_ERRORS
from git.util import to_native_path_linux, join_path_native


Expand Down
2 changes: 1 addition & 1 deletion git/test/test_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
Tree,
Blob
)
from git.test.lib.helper import HIDE_WINDOWS_KNOWN_ERRORS
from git.util import HIDE_WINDOWS_KNOWN_ERRORS
from git.test.lib import TestBase


Expand Down
11 changes: 8 additions & 3 deletions git/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from functools import wraps

from git.compat import is_win
from gitdb.util import ( # NOQA
from gitdb.util import (# NOQA
make_sha,
LockedFD, # @UnusedImport
file_contents_ro, # @UnusedImport
Expand All @@ -44,7 +44,13 @@
__all__ = ("stream_copy", "join_path", "to_native_path_windows", "to_native_path_linux",
"join_path_native", "Stats", "IndexFileSHA1Writer", "Iterable", "IterableList",
"BlockingLockFile", "LockFile", 'Actor', 'get_user_id', 'assure_directory_exists',
'RemoteProgress', 'CallableRemoteProgress', 'rmtree', 'unbare_repo')
'RemoteProgress', 'CallableRemoteProgress', 'rmtree', 'unbare_repo',
'HIDE_WINDOWS_KNOWN_ERRORS')

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

#{ Utility Methods

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

0 comments on commit 74c7ed0

Please sign in to comment.