Skip to content

tests: root temporary database and server directories under pytest tmp_path - #141

Merged
tae898 merged 1 commit into
mainfrom
test/fixtures-tmp-path
Oct 29, 2026
Merged

tae898 merged 1 commit into
mainfrom
test/fixtures-tmp-path

Conversation

@tae898

@tae898 tae898 commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

The temporary database and server-root fixtures now create their directories with pytest's tmp_path_factory.mktemp (or tmp_path) instead of tempfile.mkdtemp. A killed run never reaches teardown, so the old directories stayed in /tmp for good (48 arcadedb_test_db_* directories on 2026-10-25). pytest keeps only its last three basetemp runs, so nothing permanent is left now.

Changed: temp_server_root, temp_db_path, temp_db and temp_dir_factory in tests/conftest.py; the module fixture db in tests/test_resultset_read_errors.py; the temp_db_path fixtures in tests/test_import_database.py and tests/test_exporter.py; cleanup_test_dirs in tests/test_server_patterns.py; cleanup_db in tests/test_concurrency.py; the tmp fixture in tests/test_free_threading.py; and test_async_executor_sql_command_insert_is_exact_at_parallel_one, which also leaked its mkdtemp parent on a normal exit. The explicit close and rmtree with the Windows retry stay, since pytest's cleanup is lazy and cannot retry a directory the JVM still holds. mktemp is used rather than the per-test tmp_path to keep the paths short on Windows.

Left as is: the __main__ stress path in tests/test_free_threading.py (a script, not a pytest fixture), the script strings run in a subprocess in tests/test_java_package_shadowing.py and tests/test_python_function_interrupt.py (no pytest fixtures there, and they remove their own directory), and tests/test_log_dir.py (it only reads gettempdir() to assert a default path). The NamedTemporaryFile files in tests/test_import_database.py are single CSV or XML files, not databases.

Checks: pre-commit (black, isort) passes on the changed files and the files compile. pyflakes reports only the existing f-string warning in tests/test_server_patterns.py, which is also on main. The suite was not run locally; CI covers it.

Closes #140

🤖 Generated with Claude Code

…p_path

A killed run never reaches fixture teardown, so the mkdtemp directories stayed in /tmp for good (48 arcadedb_test_db_* directories on 2026-10-25, each with a database.lck). pytest keeps only its last three basetemp runs, so directories made through tmp_path_factory are removed by the next runs.

The explicit close and rmtree with the Windows retry stay. test_async_executor also leaked its mkdtemp parent on a normal exit; it now uses tmp_path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tae898
tae898 merged commit b2d9f2d into main Oct 29, 2026
36 checks passed
@tae898
tae898 deleted the test/fixtures-tmp-path branch October 29, 2026 18:03
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.

Tests: a killed run leaves arcadedb_test_db_* dirs in /tmp; use pytest tmp_path

1 participant