You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since many commands have specific usages of the current working directory,
running commands from within a specific directory would smooth integrating nox
is existing projects.
As a workaround, see the following context manager implementation
fromcontextlibimportcontextmanagerfrompathlibimportPathfromtypingimportUnionimportosimportnox@nox.session()deftest(session: nox.Session):
session.install('pytest')
withcurrent_working_directory(Path("somewhere/deep/in/monorepo")):
session.run(sys.executable, "-m", "pytest")
@contextmanagerdefcurrent_working_directory(path: Union[Path, str]):
"""Sets the cwd within the context Args: path: The path to the cwd Yields: None """origin=Path().absolute()
try:
os.chdir(path)
yieldfinally:
os.chdir(origin)
How would this feature be useful?
Since many commands have specific usages of the current working directory,
running commands from within a specific directory would smooth integrating nox
is existing projects.
Describe the solution you'd like
Describe alternatives you've considered
The text was updated successfully, but these errors were encountered: