Skip to content

pytest runner: use a container-local --basetemp so tmp_path works - #61

Open
ArjunS07 wants to merge 1 commit into
fix/base-run-ignores-new-test-filesfrom
fix/pytest-basetemp-in-container
Open

ArjunS07 wants to merge 1 commit into
fix/base-run-ignores-new-test-filesfrom
fix/pytest-basetemp-in-container

Conversation

@ArjunS07

Copy link
Copy Markdown
Contributor

Purpose

Trials set TMPDIR to a folder mounted from the host. pytest puts its temporary root there (pytest-of-<user>), and when that folder belongs to another uid, pytest refuses it: every test that uses tmp_path or tmpdir errors at setup ("temporary directory ... is not owned by the current user"). This happened in the agent run and in the base run, so the regression check compared zero passing tests and could not find any regression.

Seen on memray#294 (all 12 trials), xarray#9770 (all 8; 4,700+ tests each), django-components#1538 (all 4) and 4 trials of dwave-cloud-client#709.

Changes

  • template/tests/pytest_runner.py run_pytest_and_collect: when the caller gives no --basetemp, pass --basetemp=<new folder under /tmp> (inside the container).
    • Before: pytest used $TMPDIR/pytest-of-<user>.
  • tests/docker/test_pytest_runner_regression.py: test_tmp_path_works_when_the_temp_root_belongs_to_another_user; fails without the change.

Verification

  • tests/docker/test_pytest_runner_regression.py: 7 passed.

Notes

Stacked on #60.

This branch has not been deployed

No deployments
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.

1 participant