diff options
author | Erik Skultety <eskultet@redhat.com> | 2023-03-29 14:56:01 +0200 |
---|---|---|
committer | Daniel P. Berrangé <berrange@redhat.com> | 2023-03-30 08:00:42 +0000 |
commit | 21c30c59671c319e41a6c9f129d0f6b9d07286a5 (patch) | |
tree | e6330bdfb2b0e5a4c3b53480189961003be9d01f | |
parent | a00092955f51b621ce4cf3267655043d133dfe47 (diff) | |
download | libvirt-ci-21c30c59671c319e41a6c9f129d0f6b9d07286a5.zip libvirt-ci-21c30c59671c319e41a6c9f129d0f6b9d07286a5.tar.gz libvirt-ci-21c30c59671c319e41a6c9f129d0f6b9d07286a5.tar.bz2 |
tests: conftest: Introduce a global fixture assert_equal
This fixture is going to be used by every single positive tests.
Because it's global, it's going to be available everywhere, and because
it return a higher order function, it can only accept arguments for the
actual and expected outputs to be compared, everything else it
transparent to the test writer.
Signed-off-by: Erik Skultety <eskultet@redhat.com>
-rw-r--r-- | tests/conftest.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/conftest.py b/tests/conftest.py index d82a303..15ce052 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -69,6 +69,14 @@ def config(monkeypatch, request): @pytest.fixture +def assert_equal(request, tmp_path_factory): + def _assert_equal(actual, expected): + tmp_dir = Path(tmp_path_factory.getbasetemp(), request.node.name) + return test_utils._assert_equal(actual, expected, test_tmp_dir=tmp_dir) + return _assert_equal + + +@pytest.fixture def inventory(monkeypatch, targets, config): inventory = Inventory(targets, config) |