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
Change PantsIntegrationTest
to be hermetic by default
#10672
Conversation
# 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]
# 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]
PantsIntegrationTest
PantsIntegrationTest
f598eff
to
7e8a8fe
Compare
# 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]
7e8a8fe
to
007dd16
Compare
class InvalidTestEnvironmentError(Exception): | ||
"""Raised when the external environment is not set up properly to run integration tests.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was unused, so deleted.
def setUp(self): | ||
super().setUp() | ||
# Some integration tests rely on clean subsystem state (e.g., to set up a DistributionLocator). | ||
Subsystem.reset() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deleted. No need for this.
def temporary_workdir(self, cleanup=True): | ||
# We can hard-code '.pants.d' here because we know that will always be its value | ||
# in the pantsbuild/pants repo (e.g., that's what we .gitignore in that repo). | ||
# Grabbing the pants_workdir config would require this pants's config object, | ||
# which we don't have a reference to here. | ||
root = os.path.join(get_buildroot(), ".pants.d", "tmp") | ||
safe_mkdir(root) | ||
return temporary_dir(root_dir=root, cleanup=cleanup, suffix=".pants.d") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kept, but moved down in the file near the other "temporary" methods.
PantsIntegrationTest
PantsIntegrationTest
to be hermetic by default
# 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]
Several refactors:
hermetic
a class property rather than classmethod. Default to True.use_pantsd_env_var
to a class propertyuse_pantsd
. Removes the env var mechanism as we no longer use that. Defaults to pantsd being used.hermetic_env_whitelist
tohermetic_env_allowlist
, and make it a class property.do_command()
in favor ofself.run_pants()
. It does the same thing. We want to simplify.file_renamed
. We generally are moving in the direction of our integration tests creating their own environment, rather than mutating the build root (e.g. testprojects). This wasn't being used.A followup will make it more convenient to create temporary content, which is a common pattern for newly written integration tests.
[ci skip-rust]
[ci skip-build-wheels]