There was an error while loading. Please reload this page.
1 parent 7cd47ae commit 4ba76d6Copy full SHA for 4ba76d6
2 files changed
git/__init__.py
@@ -19,7 +19,7 @@
19
def _init_externals():
20
"""Initialize external projects by putting them into the path"""
21
if __version__ == 'git' and 'PYOXIDIZER' not in os.environ:
22
- sys.path.insert(0, osp.join(osp.dirname(__file__), 'ext', 'gitdb'))
+ sys.path.insert(1, osp.join(osp.dirname(__file__), 'ext', 'gitdb'))
23
24
try:
25
import gitdb
test/test_installation.py
@@ -1,6 +1,7 @@
1
# This module is part of GitPython and is released under
2
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
3
4
+import ast
5
import os
6
import subprocess
7
from test.lib import TestBase
@@ -27,3 +28,8 @@ def test_installation(self, rw_dir):
27
28
self.assertEqual(0, result.returncode, msg=result.stderr or result.stdout or "Can't build - setup.py failed")
29
result = subprocess.run([self.python, '-c', 'import git'], stdout=subprocess.PIPE, cwd=self.sources)
30
self.assertEqual(0, result.returncode, msg=result.stderr or result.stdout or "Selftest failed")
31
+ result = subprocess.run([self.python, '-c', 'import sys;import git; print(sys.path)'], stdout=subprocess.PIPE, cwd=self.sources)
32
+ syspath = result.stdout.decode('utf-8').splitlines()[0]
33
+ syspath = ast.literal_eval(syspath)
34
+ self.assertEqual('', syspath[0], msg='Failed to follow the conventions for https://docs.python.org/3/library/sys.html#sys.path')
35
+ self.assertTrue(syspath[1].endswith('gitdb'), msg='Failed to add gitdb to sys.path')
0 commit comments