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 RuleRunner.set_options() #10859

Merged
merged 3 commits into from Sep 25, 2020
Merged

Conversation

Eric-Arellano
Copy link
Contributor

As of #10827, options are now set up through a new SessionValues mechanism. This means that our tests should no longer be passing OptionsBootstrapper as a Param anymore.

Instead, we must mutate the SchedulerSession when setting options. We surface a new entry-point .set_options(), which will change the options for the life of the RuleRunner instance.

rule_runner.set_options(["--pants-ignore=['foo']"])

RuleRunner already was high on mutation, such as rule_runner.create_file() mutating the build root. This is why we encourage using Pytest fixtures to ensure each test is a new instance.

A followup will move PantsEnvironment to a SessionValue.

[ci skip-rust]
[ci skip-build-wheels]

# Rust tests and lints will be skipped. Delete if not intended.
[ci skip-rust]

# Building wheels and fs_util will be skipped. Delete if not intended.
[ci skip-build-wheels]
[ci skip-rust]
[ci skip-build-wheels]
[ci skip-rust]
[ci skip-build-wheels]
@coveralls
Copy link

Coverage Status

Coverage remained the same at 0.0% when pulling a00adb5 on Eric-Arellano:set-options into ee98ef6 on pantsbuild:master.

Copy link
Sponsor Member

@stuhood stuhood left a comment

Choose a reason for hiding this comment

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

Awesome!

@Eric-Arellano Eric-Arellano merged commit 0672196 into pantsbuild:master Sep 25, 2020
@Eric-Arellano Eric-Arellano deleted the set-options branch September 25, 2020 18:14
Eric-Arellano added a commit that referenced this pull request Sep 25, 2020
As introduced in #10827, this is a more correct modeling for reading the environment variables. It will result in less invalidation of Pantsd.

Likewise, we can extend our `rule_runner.set_options()` method introduced in #10859 to simplify how tests change the `PantsEnvironment`.

[ci skip-rust]
[ci skip-build-wheels]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants