-
-
Notifications
You must be signed in to change notification settings - Fork 167
Closed
Labels
Description
Describe the bug
If a FileNotFoundError
occurs somewhere on module-level within noxfile.py
, nox will display a misleading error:
misleading error "Failed to load Noxfile noxfile.py, no such file exists."
The problem is here: https://github.com/theacodes/nox/blob/main/nox/tasks.py#L109
This except
clause is harmful. Something like this would solve the problem:
if not Path(global_config.noxfile).exists():
logger.error(
f"Failed to load Noxfile {global_config.noxfile}, no such file exists."
)
return 2
Shall I create a PR?
How to reproduce
noxfile.py:
from pathlib import Path
import nox
requirements = Path("/non-existing/path/requirements.txt").read_text()
@nox.session(python=["3.9"])
def foo(session):
pass
$ nox -s foo
nox > Failed to load Noxfile [...]/noxfile.py, no such file exists.
Expected behavior
The stack trace of the actual error should be visible.