From bc9525356632c640048d0d55d5e67b9ce25c3f15 Mon Sep 17 00:00:00 2001 From: Jack Wilsdon Date: Thu, 30 May 2019 14:45:31 +1000 Subject: [PATCH] Setup path correctly in testall.py By comparing `sys.path` as setup by nose vs. testall.py it seems that we weren't adding the top-level beets directory to the path. The script was also previously changing the working directory before running the tests. --- test/testall.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/test/testall.py b/test/testall.py index 88eb70117..418b4a3ca 100755 --- a/test/testall.py +++ b/test/testall.py @@ -22,16 +22,15 @@ import re import sys import unittest -pkgpath = os.path.dirname(__file__) or '.' -sys.path.append(pkgpath) -os.chdir(pkgpath) +pkgpath = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) or '..' +sys.path.insert(0, pkgpath) def suite(): s = unittest.TestSuite() # Get the suite() of every module in this directory beginning with # "test_". - for fname in os.listdir(pkgpath): + for fname in os.listdir(os.path.join(pkgpath, 'test')): match = re.match(r'(test_\S+)\.py$', fname) if match: modname = match.group(1)