Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0b9094b

Browse files
committed
BUG: runtests: make -t option work again
1 parent 18acfa4 commit 0b9094b

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

runtests.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ def main(argv):
136136
extra_argv += ['--cover-html',
137137
'--cover-html-dir='+dst_dir]
138138

139+
test_dir = os.path.join(ROOT_DIR, 'build', 'test')
140+
139141
if args.build_only:
140142
sys.exit(0)
141143
elif args.submodule:
@@ -147,19 +149,26 @@ def main(argv):
147149
print("Cannot run tests for %s" % modname)
148150
sys.exit(2)
149151
elif args.tests:
152+
def fix_test_path(x):
153+
# fix up test path
154+
p = x.split(':')
155+
p[0] = os.path.relpath(os.path.abspath(p[0]),
156+
test_dir)
157+
return ':'.join(p)
158+
159+
tests = [fix_test_path(x) for x in args.tests]
160+
150161
def test(*a, **kw):
151162
extra_argv = kw.pop('extra_argv', ())
152-
extra_argv = extra_argv + args.tests[1:]
163+
extra_argv = extra_argv + tests[1:]
153164
kw['extra_argv'] = extra_argv
154165
from numpy.testing import Tester
155-
return Tester(args.tests[0]).test(*a, **kw)
166+
return Tester(tests[0]).test(*a, **kw)
156167
else:
157168
__import__(PROJECT_MODULE)
158169
test = sys.modules[PROJECT_MODULE].test
159170

160171
# Run the tests under build/test
161-
test_dir = os.path.join(ROOT_DIR, 'build', 'test')
162-
163172
try:
164173
shutil.rmtree(test_dir)
165174
except OSError:

0 commit comments

Comments
 (0)