Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: Restore cwd before removing a tree
The fixture `tmpdir` cleans up temp files/dirs on teardown. `test_paths_resolved` in turn uses fixture `monkeypatch` for patching cwd (it's changed to `tmpdir`). `monkeypatch` restores back its changes on teardown. But the teardown of `tmpdir` occurs earlier and this triggers removal error on Solaris where `rmdir` can't remove current working directory. https://docs.oracle.com/cd/E88353_01/html/E37841/rmdir-2.html: > EINVAL The directory to be removed is the current directory, or the final component of path is “.”. So, the order of Pytest's fixtures was incorrect: ``` tests/unit/test_build/test_builder.py::test_paths_resolved SETUP S pytestconfig SETUP S tmp_path_factory SETUP F monkeypatch SETUP F mocker (fixtures used: pytestconfig) SETUP F mock_build (fixtures used: mocker) SETUP F tmp_path (fixtures used: tmp_path_factory) SETUP F tmpdir (fixtures used: tmp_path) SETUP F pyproject (fixtures used: tmpdir) tests/unit/test_build/test_builder.py::test_paths_resolved (fixtures used: mock_build, mocker, monkeypatch, pyproject, pytestconfig, request, tmp_path, tmp_path_factory, tmpdir) TEARDOWN F pyproject TEARDOWN F tmpdir TEARDOWN F tmp_path TEARDOWN F mock_build TEARDOWN F mocker TEARDOWN F monkeypatch TEARDOWN S tmp_path_factory TEARDOWN S pytestconfig ``` Fixes: #33 Signed-off-by: Stanislav Levin <slev@altlinux.org>
- Loading branch information