From 0a7e893c0851db19a8b7d040cdec9f305464c403 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Fri, 28 Aug 2020 11:17:50 +0100 Subject: [PATCH] Add changelog entry --- changelog/7695.feature.rst | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 changelog/7695.feature.rst diff --git a/changelog/7695.feature.rst b/changelog/7695.feature.rst new file mode 100644 index 00000000000..a083e215bde --- /dev/null +++ b/changelog/7695.feature.rst @@ -0,0 +1,19 @@ +A new hook was added, `pytest_markeval_namespace` which should return a dictionary. +This dictionary will be used to augment the "global" variables available to evaluate skipif/xfail/xpass markers. + +Psudo example + +``conftest.py``: + +.. code-block:: python + + def pytest_markeval_namespace(): + return {"color": "red"} + +``test_func.py``: + +.. code-block:: python + + @pytest.mark.skipif("color == 'blue'", reason="Color is not red") + def test_func(): + assert False