Skip to content

Commit 655160f

Browse files
committed
Adjust PYTHON_PATH adjuster to be friendlier
* When the package is installed on the system, make the test suite find the repo version first
1 parent fefbe01 commit 655160f

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

test/main.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,15 @@ def locate_package(pkg):
6060
def setup_tincan_path():
6161
tincan_pardir = locate_package('tincan')
6262
if tincan_pardir and tincan_pardir not in sys.path:
63+
#
64+
# using sys.path.insert in this manner is considered a little evil,
65+
# see http://stackoverflow.com/questions/10095037/why-use-sys-path-appendpath-instead-of-sys-path-insert1-path
66+
# but this is better than using the sys.path.append as before
67+
# as that was catching the system installed version, if virtualenv
68+
# is ever implemented for the test suite then this can go away
69+
#
6370
print "Adding %s to PYTHONPATH" % repr(tincan_pardir)
64-
sys.path.append(tincan_pardir)
71+
sys.path.insert(1, tincan_pardir)
6572
check_tincan_importability()
6673

6774

@@ -72,4 +79,4 @@ def setup_tincan_path():
7279
test_pardir = locate_package('test')
7380
test_dir = os.path.join(test_pardir, 'test')
7481
suite = loader.discover(test_dir, pattern='*_test.py')
75-
unittest.TextTestRunner(verbosity=1).run(suite)
82+
unittest.TextTestRunner(verbosity=1).run(suite)

0 commit comments

Comments
 (0)