From 21c30c59671c319e41a6c9f129d0f6b9d07286a5 Mon Sep 17 00:00:00 2001 From: Erik Skultety Date: Wed, 29 Mar 2023 14:56:01 +0200 Subject: 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 --- tests/conftest.py | 8 ++++++++ 1 file changed, 8 insertions(+) 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) -- cgit v1.1