Support calling compile
command from when cwd is a source checkout
#207
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
pyperformance compile
command currently fails when the current directoryis a source checkout, since the installation of pyperformance in the benchmark
venv is slightly broken, and the detection of running from a source checkout is
slightly broken. This is true whether using
python -m pyperformance
orpython ./dev.py
methods.To detect whether performance is being imported from an "installation" rather
than the source directory, it imports toml and then sees if there is a
pyperformance
package sitting alongside it. This (perhaps) worked in the pastwhen
toml
was a module, but it's currently a package, so we need to go up twolevels of directories.
pyperformance
is installed in the benchmark venvs withpip install .
, butpip install -e .
actually installs in editable/developer mode, as describedelsewhere.
I struggled to write a short-running unit test for this -- there are a lot of moving parts that need to align to reproduce this. However, there is an existing test that currently fails on main, but passes with these changes. It's marked as
@SLOW
, so I suspect it hasn't run on CI in quite some time. I'd appreciate any thoughts about whether that's sufficient...