mirror of
https://github.com/borgbackup/borg.git
synced 2026-09-02 06:33:19 +02:00
The autouse test-isolation fixtures (clean_env, reset_progress_logger, default_patches) lived only in the repo-root conftest.py. That file is not installed with the package, and pytest does not apply a rootdir conftest's fixtures to tests collected from a different directory tree. On CI the tests run against the sdist-installed package via `pytest --pyargs borg.testsuite` (tox), i.e. from site-packages/borg/testsuite/ - so the fixtures never ran there, and tests leaked state into each other: - BORG_NEW_PASSPHRASE leaked from test_change_passphrase, making later repokey `init` encrypt with the wrong passphrase -> ~330 spurious PassphraseWrong failures in archiver create tests. - XDG_CONFIG_HOME was not isolated, so nonce/key tests read+wrote the real security dir and poisoned each other (nonce/IV assertions). - the borg.output.progress logger handler leaked (progress test failures). These only showed up on py>=3.10 because pytest is unpinned: py3.9 resolves an older pytest that still applied the rootdir fixtures to --pyargs tests. Move conftest.py into src/borg/testsuite/ (matching 1.4-maint/master) so it is installed alongside the tests and its fixtures always apply. Adjust the flake8 / pre-commit targets accordingly (it is now covered by `flake8 src`). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013bFWgq2KV6oYxmfH6Zqvp3
35 lines
771 B
INI
35 lines
771 B
INI
# tox configuration - if you change anything here, run this to verify:
|
|
# fakeroot -u tox --recreate
|
|
|
|
[tox]
|
|
envlist = py{39,310,311,312}-{none,fuse2,fuse3}
|
|
minversion = 3.2
|
|
requires =
|
|
pkgconfig
|
|
cython
|
|
wheel
|
|
setuptools_scm
|
|
[testenv]
|
|
setenv =
|
|
fuse2: BORG_FUSE_IMPL=llfuse
|
|
fuse3: BORG_FUSE_IMPL=pyfuse3
|
|
deps =
|
|
fuse2: llfuse
|
|
fuse3: pyfuse3
|
|
-rrequirements.d/development.txt
|
|
commands = py.test -v -n {env:XDISTN:1} -rs --cov=borg --cov-config=.coveragerc --benchmark-skip --pyargs {posargs:borg.testsuite}
|
|
# fakeroot -u needs some env vars:
|
|
passenv = *
|
|
|
|
|
|
[testenv:.pkg]
|
|
passenv = * # needed by tox4, so env vars are visible for building borg
|
|
|
|
|
|
[testenv:flake8]
|
|
skip_sdist=true
|
|
skip_install=true
|
|
changedir =
|
|
deps =
|
|
flake8
|
|
commands = flake8 src scripts
|