Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4ba76d6

Browse files
Xavier VergesByron
Xavier Verges
authored andcommitted
Do not break convention when updating sys.path
1 parent7cd47ae commit4ba76d6

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

‎git/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
def_init_externals():
2020
"""Initialize external projects by putting them into the path"""
2121
if__version__=='git'and'PYOXIDIZER'notinos.environ:
22-
sys.path.insert(0,osp.join(osp.dirname(__file__),'ext','gitdb'))
22+
sys.path.insert(1,osp.join(osp.dirname(__file__),'ext','gitdb'))
2323

2424
try:
2525
importgitdb

‎test/test_installation.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# This module is part of GitPython and is released under
22
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
33

4+
importast
45
importos
56
importsubprocess
67
fromtest.libimportTestBase
@@ -27,3 +28,8 @@ def test_installation(self, rw_dir):
2728
self.assertEqual(0,result.returncode,msg=result.stderrorresult.stdoutor"Can't build - setup.py failed")
2829
result=subprocess.run([self.python,'-c','import git'],stdout=subprocess.PIPE,cwd=self.sources)
2930
self.assertEqual(0,result.returncode,msg=result.stderrorresult.stdoutor"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

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp