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

Unable to change the current working directory in ./pants test --debug #16120

Closed
achimnol opened this issue Jul 10, 2022 · 1 comment · Fixed by #16093
Closed

Unable to change the current working directory in ./pants test --debug #16120

achimnol opened this issue Jul 10, 2022 · 1 comment · Fixed by #16093
Labels

Comments

@achimnol
Copy link

achimnol commented Jul 10, 2022

Describe the bug
When a pytest session is run with --debug flag, its current working directory is always set to /tmp/.tmpXXXX (where XXXX is a random string), regardless of the local_execution_root_dir setting nor the TMPDIR environment variable.

image

Pants version
2.12.0 with custom patches to run on Linux aarch64.

OS
Linux (Ubuntu 20.04)

Additional info
I digged down where the strange /tmp path comes out and found that src/rust/engine/src/intrinsic.rs:L588 is the ultimate source.

I'm not sure why the comments in the sources are saying run_in_workspace should be false and I have no idea about what the intended behavior is. The Python-side code of Pants does not set any specific path for the venv-pex processes.

Though, when I and my colleague (@kyujin-cho) asked "how to change the cwd of pytest session?", we got replies to set local_execution_root_dir and it had no effects in the --debug mode. So we are reporting this as a bug report.

Note that we hit this problem because Snap-based Docker installation does not allow using the host's /tmp directory for mounting volumes inside the container.

@achimnol achimnol added the bug label Jul 10, 2022
@stuhood
Copy link
Member

stuhood commented Jul 10, 2022

Thanks for the report: this will be fixed by #16093.

stuhood added a commit that referenced this issue Jul 12, 2022
…orkspace=True` (#16093)

As described in #16105, blocking code in `@rule` bodies can trigger a shutdown race condition when `pantsd` is disabled and `Ctrl+C` is sent.

Longer term solutions are discussed on that issue, but in the short term, we can avoid using blocking code for `InteractiveProcess`, such that `run` uses the same sandbox creation, async teardown, and relativizing code as `Process` does.

Fixes #13852, fixes #14386, fixes #16120, and fixes #15771.
stuhood added a commit to stuhood/pants that referenced this issue Jul 12, 2022
…orkspace=True` (pantsbuild#16093)

As described in pantsbuild#16105, blocking code in `@rule` bodies can trigger a shutdown race condition when `pantsd` is disabled and `Ctrl+C` is sent.

Longer term solutions are discussed on that issue, but in the short term, we can avoid using blocking code for `InteractiveProcess`, such that `run` uses the same sandbox creation, async teardown, and relativizing code as `Process` does.

Fixes pantsbuild#13852, fixes pantsbuild#14386, fixes pantsbuild#16120, and fixes pantsbuild#15771.

[ci skip-build-wheels]
stuhood added a commit that referenced this issue Jul 12, 2022
…orkspace=True` (Cherry-pick of #16093) (#16148)

As described in #16105, blocking code in `@rule` bodies can trigger a shutdown race condition when `pantsd` is disabled and `Ctrl+C` is sent.

Longer term solutions are discussed on that issue, but in the short term, we can avoid using blocking code for `InteractiveProcess`, such that `run` uses the same sandbox creation, async teardown, and relativizing code as `Process` does.

Fixes #13852, fixes #14386, fixes #16120, and fixes #15771.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants