This repository has been archived by the owner on Nov 15, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: fix
disable_sysfs_net
mock (canonical#5065)
The fixture parametrization ability added in 9baf31c doesn't work as expected. When you have a session-wide fixture, the setup is run once, then further invocations of the fixture (including autouse) uses a cached version of the fixture. Teardown for the session fixture happens at the end of all test runs. This also applies to mock patching. Since the mock patching happens only once, parametrizing the fixture to yield without patching doesn't undo the initial mock setup; the parametrization of `disable_sys_net` effectively does nothing. The good news is that patches stack, so current tests that patch `get_sys_class_path` differently will still work fine. If we need to disable the patching entirely, that is also possible by saving the original `get_sys_class_path` before applying the global disable mock, then having a separate mock that has a side effect of calling the original function.
- Loading branch information