Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: Apply ASV_PYTHONPATH to discovery #1462

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions asv/benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,25 @@ def main():
mode = sys.argv[1]
args = sys.argv[2:]

env = os.environ.copy()
# --- Modify sys.path for the current interpreter ---
if 'ASV_PYTHONPATH' in env:
new_paths = env['ASV_PYTHONPATH'].split(os.pathsep)
for path in reversed(new_paths): # Add to the front to prioritize
if path not in sys.path:
sys.path.insert(0, path)
# Remove ASV_PYTHONPATH from env, as it's no longer needed after sys.path update
env.pop('ASV_PYTHONPATH')
else:
# Clean up sys.path if PYTHONPATH was set but ASV_PYTHONPATH is not
if 'PYTHONPATH' in env:
old_paths = env['PYTHONPATH'].split(os.pathsep)
for path in old_paths:
if path in sys.path:
sys.path.remove(path)

env.pop('PYTHONPATH')

if mode in commands:
commands[mode](args)
sys.exit(0)
Expand Down
4 changes: 2 additions & 2 deletions asv/commands/compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ def results_default_iter(commit_hash):
elif time_1 is None and time_2 is not None:
# fixed a failure
color = 'green'
mark = ' '
mark = '*'
improved = True
elif time_1 is None and time_2 is None:
# both failed
Expand Down Expand Up @@ -334,7 +334,7 @@ def results_default_iter(commit_hash):
_is_result_better(time_2, time_1, None, None, factor)):
ratio = "~" + ratio.strip()

if only_changed and mark in (' ', 'x'):
if only_changed and mark in (' ', 'x', '*'):
continue

unit = units[benchmark]
Expand Down
1 change: 1 addition & 0 deletions changelog.d/+f99f1374.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Indicate when benchmarks start passing with *
1 change: 1 addition & 0 deletions changelog.d/1463.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ASV_PYTHONPATH is now applied for the discovery phase.
2 changes: 1 addition & 1 deletion docs/source/using.rst
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ each of its symbolic states can be understood as:
- Introduced a failure
- Failed
- Succeeded
* -
* - ``*``
- Green
- Fixed failure
- Succeeded
Expand Down
Loading