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

Benchmark discovery fails if "./" is not prepended to a relative path #69

Closed
nicholasjng opened this issue Feb 8, 2024 · 0 comments · Fixed by #70
Closed

Benchmark discovery fails if "./" is not prepended to a relative path #69

nicholasjng opened this issue Feb 8, 2024 · 0 comments · Fixed by #70
Labels
bug Something isn't working urgent Needs to be worked on ASAP.

Comments

@nicholasjng
Copy link
Collaborator

nicholasjng commented Feb 8, 2024

Currently, when having the following example directory structure:

src/benchmarks.py
   /main.py

executing runner.run("benchmarks.py", ...) from inside the src directory results in an importlib error:

Apparently, the ismodule check falls through to the very last import attempt, which fails since the found module does not have a __path__ set.

This is an indication that the discovery branch is backwards - to fix, we can try calling path.is_{file,dir}() on the input first, and only then try to understand it as a module name.

This should be safe since the Python file has a suffix .py, which eliminates collisions between e.g. __main__ (the module name) and __main__.py.

Also, once it's fixed, docs should be updated.

@nicholasjng nicholasjng added bug Something isn't working urgent Needs to be worked on ASAP. labels Feb 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working urgent Needs to be worked on ASAP.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant