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.
@@ -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)
