diff options
author | zsdc <taras@vyos.io> | 2022-03-25 20:58:01 +0200 |
---|---|---|
committer | zsdc <taras@vyos.io> | 2022-03-25 21:42:00 +0200 |
commit | 31448cccedd8f841fb3ac7d0f2e3cdefe08a53ba (patch) | |
tree | 349631a02467dae0158f6f663cc8aa8537974a97 /conftest.py | |
parent | 5c4b3943343a85fbe517e5ec1fc670b3a8566b4b (diff) | |
parent | 8537237d80a48c8f0cbf8e66aa4826bbc882b022 (diff) | |
download | vyos-cloud-init-31448cccedd8f841fb3ac7d0f2e3cdefe08a53ba.tar.gz vyos-cloud-init-31448cccedd8f841fb3ac7d0f2e3cdefe08a53ba.zip |
T2117: Cloud-init updated to 22.1
Merged with 22.1 tag from the upstream Cloud-init repository.
Our modules were slightly modified for compatibility with the new
version.
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 |