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

Python tests should be run in chroots to enforce proper loose file dependency declaration. #5019

Closed
stuhood opened this issue Oct 26, 2017 · 0 comments · Fixed by #5033
Closed
Assignees

Comments

@stuhood
Copy link
Sponsor Member

stuhood commented Oct 26, 2017

#4780 handled the JVM side of this, but as far as I can tell the pytest runner does not actually change CWD into the chroot, so it is still possible to access loose files (as demonstrated by https://github.com/pantsbuild/pants/blob/master/tests/python/pants_test/pants_run_integration_test.py subclasses not actually needing any files(..) target dependencies to succeed). Having undeclared dependencies caused master breakage due to cached tests, and so test caching was disabled in travis in #5016.

This ticket covers adding the option to change working directories, and hopefully using it somewhere in pantsbuild/pants CI... the unit test shards seem like a good target, as they don't require tackling the integration test dependencies.

stuhood pushed a commit that referenced this issue Oct 26, 2017
### Problem

#5011 introduced a failure in an integration test which was missed due to #5019.

### Solution

Fix the test by moving the decision between using custom Javac and using the `tools.jar` out of `JavacPlugin` and into the `ProvideToolsJar` task (which runs after `bootstrap-jvm-tools`).

### Result

Fixes #5020.
jsirois added a commit to jsirois/pants that referenced this issue Oct 29, 2017
With the new `--chroot` option, tests are run with `CWD` set to the
`py.test` pex chroot making access of un-declared file dependencies
~impossible and ensuring all files involved in `py.test` execution are
part of the test cache key.

Fixes pantsbuild#5019

NB: Not ready for review.
jsirois added a commit to jsirois/pants that referenced this issue Nov 2, 2017
With the new `--chroot` option, tests are run with `CWD` set to the
`py.test` pex chroot making access of un-declared file dependencies
~impossible and ensuring all files involved in `py.test` execution are
part of the test cache key.

Fixes pantsbuild#5019

NB: Not ready for review.
jsirois added a commit to jsirois/pants that referenced this issue Nov 6, 2017
With the new `--chroot` option, tests are run with `CWD` set to the
`py.test` pex chroot making access of un-declared file dependencies
~impossible and ensuring all files involved in `py.test` execution are
part of the test cache key.

Fixes pantsbuild#5019

NB: Not ready for review.
jsirois added a commit to jsirois/pants that referenced this issue Nov 6, 2017
With the new `--chroot` option, tests are run with `CWD` set to the
`py.test` pex chroot making access of un-declared file dependencies
~impossible and ensuring all files involved in `py.test` execution are
part of the test cache key.

Fixes pantsbuild#5019

NB: Not ready for review.
jsirois added a commit to jsirois/pants that referenced this issue Nov 7, 2017
With the new `--chroot` option, tests are run with `CWD` set to the
`py.test` pex chroot making access of un-declared file dependencies
~impossible and ensuring all files involved in `py.test` execution are
part of the test cache key.

CWD switching revealed an assumption error in the java
SubprocessExecutor and a relative path error in Travis CI
configuration, both now fixed.

Fixes pantsbuild#5019
jsirois added a commit to jsirois/pants that referenced this issue Nov 7, 2017
With the new `--chroot` option, tests are run with `CWD` set to the
`py.test` pex chroot making access of un-declared file dependencies
~impossible and ensuring all files involved in `py.test` execution are
part of the test cache key.

CWD switching revealed an assumption error in the java
SubprocessExecutor and a relative path error in Travis CI
configuration, both now fixed.

Fixes pantsbuild#5019
jsirois added a commit to jsirois/pants that referenced this issue Nov 7, 2017
With the new `--chroot` option, tests are run with `CWD` set to the
`py.test` pex chroot making access of un-declared file dependencies
~impossible and ensuring all files involved in `py.test` execution are
part of the test cache key.

CWD switching revealed an assumption error in the java
SubprocessExecutor and a relative path error in Travis CI
configuration, both now fixed.

Fixes pantsbuild#5019
jsirois added a commit that referenced this issue Nov 7, 2017
With the new `--chroot` option, tests are run with `CWD` set to the
`py.test` pex chroot making access of un-declared file dependencies
~impossible and ensuring all files involved in `py.test` execution are
part of the test cache key.

CWD switching revealed an assumption error in the java
SubprocessExecutor and a relative path error in Travis CI
configuration, both now fixed.

Fixes #5019
kwlzn pushed a commit to twitter/pants that referenced this issue Nov 27, 2017
With the new `--chroot` option, tests are run with `CWD` set to the
`py.test` pex chroot making access of un-declared file dependencies
~impossible and ensuring all files involved in `py.test` execution are
part of the test cache key.

CWD switching revealed an assumption error in the java
SubprocessExecutor and a relative path error in Travis CI
configuration, both now fixed.

Fixes pantsbuild#5019
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 a pull request may close this issue.

2 participants