Skip to content

Commit ae0b6fe

Browse files
committed
Merge branch 'yarikoptic-bf/tests-on-debians'
2 parents d8bbfea + fe426d4 commit ae0b6fe

File tree

4 files changed

+21
-8
lines changed

4 files changed

+21
-8
lines changed

git/index/fun.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
S_IFREG,
1111
)
1212

13-
S_IFGITLINK = S_IFLNK | S_IFDIR # a submodule
14-
1513
from io import BytesIO
1614
import os
1715
import subprocess
@@ -33,7 +31,6 @@
3331
CE_NAMEMASK,
3432
CE_STAGESHIFT
3533
)
36-
CE_NAMEMASK_INV = ~CE_NAMEMASK
3734

3835
from .util import (
3936
pack,
@@ -47,6 +44,9 @@
4744
force_text
4845
)
4946

47+
S_IFGITLINK = S_IFLNK | S_IFDIR # a submodule
48+
CE_NAMEMASK_INV = ~CE_NAMEMASK
49+
5050
__all__ = ('write_cache', 'read_cache', 'write_tree_from_cache', 'entry_key',
5151
'stat_mode_to_index_mode', 'S_IFGITLINK', 'run_commit_hook', 'hook_path')
5252

git/test/lib/helper.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
from git import Repo, Remote, GitCommandError, Git
1616
from git.compat import string_types
1717

18-
GIT_REPO = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
18+
osp = os.path.dirname
19+
20+
GIT_REPO = os.environ.get("GIT_PYTHON_TEST_GIT_REPO_BASE", osp(osp(osp(osp(__file__)))))
1921

2022
__all__ = (
2123
'fixture_path', 'fixture', 'absolute_project_path', 'StringProcessAdapter',
@@ -26,7 +28,7 @@
2628

2729

2830
def fixture_path(name):
29-
test_dir = os.path.dirname(os.path.dirname(__file__))
31+
test_dir = osp(osp(__file__))
3032
return os.path.join(test_dir, "fixtures", name)
3133

3234

@@ -35,7 +37,7 @@ def fixture(name):
3537

3638

3739
def absolute_project_path():
38-
return os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))
40+
return os.path.abspath(os.path.join(osp(__file__), "..", ".."))
3941

4042
#} END routines
4143

@@ -195,7 +197,7 @@ def remote_repo_creator(self):
195197

196198
d_remote.config_writer.set('url', remote_repo_url)
197199

198-
temp_dir = os.path.dirname(_mktemp())
200+
temp_dir = osp(_mktemp())
199201
# On windows, this will fail ... we deal with failures anyway and default to telling the user to do it
200202
try:
201203
gd = Git().daemon(temp_dir, enable='receive-pack', as_process=True)

git/test/test_base.py

+9
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
# This module is part of GitPython and is released under
66
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
77
import os
8+
import sys
89
import tempfile
910

1011
import git.objects.base as base
@@ -116,6 +117,14 @@ def test_add_unicode(self, rw_repo):
116117
filename = u"שלום.txt"
117118

118119
file_path = os.path.join(rw_repo.working_dir, filename)
120+
121+
# verify first that we could encode file name in this environment
122+
try:
123+
file_path.encode(sys.getfilesystemencoding())
124+
except UnicodeEncodeError:
125+
from nose import SkipTest
126+
raise SkipTest("Environment doesn't support unicode filenames")
127+
119128
open(file_path, "wb").write(b'something')
120129

121130
if os.name == 'nt':

tox.ini

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ commands = {posargs}
1818
[flake8]
1919
#show-source = True
2020
# E265 = comment blocks like @{ section, which it can't handle
21+
# E266 = too many leading '#' for block comment
22+
# E731 = do not assign a lambda expression, use a def
2123
# W293 = Blank line contains whitespace
22-
ignore = E265,W293
24+
ignore = E265,W293,E266,E731
2325
max-line-length = 120
2426
exclude = .tox,.venv,build,dist,doc,git/ext/

0 commit comments

Comments
 (0)