diff options
author | zdc <zdc@users.noreply.github.com> | 2022-04-07 20:24:57 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-07 20:24:57 +0300 |
commit | 45c1d42e15f4a5fe5e176e1516b2da9d21e7837a (patch) | |
tree | 0535c3cf76b60dbf585416b4490c5bd9c9c99359 /conftest.py | |
parent | 96226f37cdbdaef2fbc51de7b9ca75b61a16792b (diff) | |
parent | aa60d48c2711cdcd9f88a4e5c77379adb0408231 (diff) | |
download | vyos-cloud-init-45c1d42e15f4a5fe5e176e1516b2da9d21e7837a.tar.gz vyos-cloud-init-45c1d42e15f4a5fe5e176e1516b2da9d21e7837a.zip |
Merge pull request #52 from vyos/current
T2117: Backport Cloud-init 22.1 with our changes to VyOS 1.3
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 |