| 1 |
import pytest |
| 2 |
|
| 3 |
|
| 4 |
@pytest.fixture(autouse=True) |
| 5 |
def dont_use_kiwi_yml_from_host( |
| 6 |
request: pytest.FixtureRequest, monkeypatch: pytest.MonkeyPatch |
| 7 |
) -> None: |
| 8 |
"""kiwi will by default read runtime config files, which influence which |
| 9 |
utilities get chosen. The users config file leaks into the test environment, |
| 10 |
which is undesirable as certain tests assume that the default tool is XYZ |
| 11 |
and assert that. This fixture prevents the loading of the runtime config |
| 12 |
files by setting all paths to falsy values that hence are ignored. |
| 13 |
|
| 14 |
This behavior can be turned off by adding the ``no_kiwi_yml_mock`` marker. |
| 15 |
|
| 16 |
""" |
| 17 |
if request.node.get_closest_marker("no_kiwi_yml_mock"): |
| 18 |
return |
| 19 |
|
| 20 |
monkeypatch.setattr("kiwi.defaults.ETC_RUNTIME_CONFIG_DIR", "") |
| 21 |
monkeypatch.setattr("kiwi.defaults.ETC_RUNTIME_CONFIG_FILE", "") |
| 22 |
monkeypatch.setattr("kiwi.defaults.USR_RUNTIME_CONFIG_DIR", "") |
| 23 |
monkeypatch.setattr("kiwi.defaults.USR_RUNTIME_CONFIG_FILE", "") |
| 24 |
monkeypatch.setattr("kiwi.defaults.CUSTOM_RUNTIME_CONFIG_FILE", None) |