Skip to content

Instantly share code, notes, and snippets.

@pv
Created December 5, 2015 23:21
Show Gist options
  • Select an option

  • Save pv/62a57c7dfb1db8eb04e4 to your computer and use it in GitHub Desktop.

Select an option

Save pv/62a57c7dfb1db8eb04e4 to your computer and use it in GitHub Desktop.
runtest asv
diff --git a/runtests.py b/runtests.py
index 9376ae5..dfe2534 100755
--- a/runtests.py
+++ b/runtests.py
@@ -197,10 +197,19 @@ def main(argv):
bench_args.extend(['--bench', a])
if not args.bench_compare:
+ # Above, we built numpy using the current sys.executable, so we
+ # need also to run asv using it.
+ import pkg_resources
cmd = ['asv', 'run', '-n', '-e', '--python=same'] + bench_args
os.chdir(os.path.join(ROOT_DIR, 'benchmarks'))
- os.execvp(cmd[0], cmd)
- sys.exit(1)
+ try:
+ sys.argv = cmd
+ sys.exit(pkg_resources.load_entry_point('asv', 'console_scripts', 'asv')())
+ except pkg_resources.ResolutionError:
+ # Fallback: asv wasn't installed for this Python version, try to
+ # run as a command...
+ os.execvp(cmd[0], cmd)
+ sys.exit(1)
else:
commits = [x.strip() for x in args.bench_compare.split(',')]
if len(commits) == 1:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment