forked from pantsbuild/pants
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove unit test runtime dependencies on resources (pantsbuild#8066)
### Problem Currently, `test_base.py`, `jvm_tool_task_test_base.py`, and `interpreter_cache_test_mixin.py` have implicit runtime dependencies on files defined at the build root, specifically `./pants`, `./BUILD.tools`, `3rdparty/BUILD`, and `.pants.d`. Because V2 is completely hermetic, these runtime dependencies fail to resolve as the test runner does not know to copy the files into the snapshot. Instead, we need some way to explicitly mark these dependencies via the `BUILD` file or to remove the dependency outright. #### FYI: why didn't we detect this earlier? We've been using V2 to run unit tests in CI for the past two months. Why didn't we detect this? The reason is that V2 runs locally in `.pantsd`, and the logic to get the buildroot traverses ancestors. This was only detected when running unit tests with remote execution. ### Solution * Remove the dependency on `./pants`, which was not actually needed. * Explicitly depend on `./BUILD.tools` and `3rdparty/BUILD`. * Remove `interpreter_cache_test_mixin.py`, which is inherently non-hermetic and cannot work with the V2 model. Even though this has a slight performance impact, this is offset by the remote caching we will now be able to get + having more sound / hermitic tests.
- Loading branch information
1 parent
514814a
commit da57bce
Showing
9 changed files
with
22 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Copyright 2019 Pants project contributors (see CONTRIBUTORS.md). | ||
# Licensed under the Apache License, Version 2.0 (see LICENSE). | ||
|
||
files( | ||
name = 'build_tools', | ||
source = 'BUILD.tools', | ||
) | ||
|
||
files( | ||
name = '3rdparty_build', | ||
source = '3rdparty/BUILD', | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 0 additions & 24 deletions
24
tests/python/pants_test/backend/python/tasks/interpreter_cache_test_mixin.py
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters