diff options
author | zdc <zdc@users.noreply.github.com> | 2022-03-26 15:41:59 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-26 15:41:59 +0200 |
commit | aa60d48c2711cdcd9f88a4e5c77379adb0408231 (patch) | |
tree | 349631a02467dae0158f6f663cc8aa8537974a97 /conftest.py | |
parent | 5c4b3943343a85fbe517e5ec1fc670b3a8566b4b (diff) | |
parent | 31448cccedd8f841fb3ac7d0f2e3cdefe08a53ba (diff) | |
download | vyos-cloud-init-aa60d48c2711cdcd9f88a4e5c77379adb0408231.tar.gz vyos-cloud-init-aa60d48c2711cdcd9f88a4e5c77379adb0408231.zip |
Merge pull request #51 from zdc/T2117-sagitta-22.1
T2117: Cloud-init updated to 22.1
Diffstat (limited to 'conftest.py')
-rw-r--r-- | conftest.py | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/conftest.py b/conftest.py index 9e9d9ff8..3979eb0a 100644 --- a/conftest.py +++ b/conftest.py @@ -12,7 +12,7 @@ from unittest import mock import pytest -from cloudinit import helpers, subp +from cloudinit import helpers, subp, util class _FixtureUtils: @@ -65,7 +65,7 @@ class _FixtureUtils: return result[0] -@pytest.yield_fixture(autouse=True) +@pytest.fixture(autouse=True) def disable_subp_usage(request, fixture_utils): """ Across all (pytest) tests, ensure that subp.subp is not invoked. @@ -138,6 +138,7 @@ def disable_subp_usage(request, fixture_utils): " this either by modifying your test code, or by modifying" " disable_subp_usage to handle precedence." ) + else: # Look this up before our patch is in place, so we have access to # the real implementation in side_effect @@ -165,7 +166,7 @@ def fixture_utils(): return _FixtureUtils -@pytest.yield_fixture +@pytest.fixture def httpretty(): """ Enable HTTPretty for duration of the testcase, resetting before and after. @@ -201,3 +202,19 @@ def paths(tmpdir): "run_dir": tmpdir.mkdir("run_dir").strpath, } return helpers.Paths(dirs) + + +@pytest.fixture(autouse=True, scope="session") +def monkeypatch_system_info(): + def my_system_info(): + return { + "platform": "invalid", + "system": "invalid", + "release": "invalid", + "python": "invalid", + "uname": ["invalid"] * 6, + "dist": ("Distro", "-1.1", "Codename"), + "variant": "ubuntu", + } + + util.system_info = my_system_info |