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

Add dry run option, test, and documentation #823

Closed
wants to merge 1 commit into from

Conversation

jklott
Copy link

@jklott jklott commented Apr 27, 2024

This PR addresses Issue #302 which requests for a dry run option to be added. This option displays to the console what steps would be taken when the command is run but does not actually run them.

As part of this PR I added a test and updated the docs accordingly. Please let me know what changes need to be made still and I am happy to fix up the PR.

@@ -405,6 +405,10 @@ def run(
msg = "First argument to `session.run` is a list. Did you mean to use `session.run(*args)`?"
raise ValueError(msg)

if self._runner.global_config.dry_run:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't these be moved down? It would not run {args} even if --dry-run was not set, because --install-only was set too.

session, _ = self.make_session_and_runner()

with mock.patch("nox.command.run", autospec=True) as run:
session.run(sys.executable, "--version", dry_run=True)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This wasn't added. And I don't think it shovel be, though, I think is should be a command line flag only. Probably monkeypatch the value here instead.

@jklott jklott closed this by deleting the head repository Jun 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants