Skip to content

ci: keep pytest's temporary files in memory - #814

Closed
karhu wants to merge 2 commits into
mainfrom
chore/ci-tmp-in-memory
Closed

karhu wants to merge 2 commits into
mainfrom
chore/ci-tmp-in-memory

Conversation

@karhu

@karhu karhu commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

Experiment: does the CI runner's disk slow the tests down? With 4 workers on each side, the CI pytest steps are still about 5 times slower than a local run, and the CPU alone explains only about 2.8 times. A full run leaves about 6.4 GB of temporary files.

This PR has two commits, pushed one at a time, so that each CI run measures one change:

  1. Delete the tmp_path of each passing test (tmp_path_retention_policy = "failed"). pytest then gives a deleted folder's name to the next test with the same name prefix, so a fixture in the root conftest.py gives each test its own subfolder with a random name. Without it, 12 tests failed. Some tests leave a reader open, and DuckDB keeps one database per file path while a connection is open, so a later test read an earlier test's control.duckdb. The CI pytest steps also pass --durations=25.
  2. Set TMPDIR=/dev/shm on the CI pytest steps, so the temporary files stay in memory.

The PR is a draft, so CI runs only the quick job, which includes the unit tests.

Checks run: make check, make lint-fix, make check-ci, make test (2,896 passed, 2 skipped, 2 xfailed), make test-unit (1,655 passed) and make test-connectors.

A full test run leaves about 6.4 GB of temporary files. pytest now
deletes the tmp_path of a test that passed when the test ends
(tmp_path_retention_policy = "failed").

pytest then gives the deleted folder's name to the next test with the
same name prefix. Some tests leave a reader open, and DuckDB keeps one
database per file path while a connection is open, so the next test
read the earlier test's control.duckdb. A tmp_path fixture in the root
conftest.py now gives each test its own subfolder with a random name.

The CI pytest steps also pass --durations=25, so each log lists the
slowest tests.
The three CI pytest steps set TMPDIR=/dev/shm, so pytest writes its temporary files to memory instead of the runner's disk.
@karhu karhu added the area:ci Changes .github/, the Makefile or release tooling label Nov 19, 2026
@karhu
karhu marked this pull request as ready for review November 19, 2026 00:49
@karhu karhu closed this Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ci Changes .github/, the Makefile or release tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant