From c6a711c2fce7259fb2b36a247771843bbf7c626d Mon Sep 17 00:00:00 2001 From: Raphael Pierzina Date: Sat, 25 Jun 2016 10:50:14 +0200 Subject: [PATCH] Add proposed solution using a module function --- doc/en/parametrize_with_fixtures.rst | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/doc/en/parametrize_with_fixtures.rst b/doc/en/parametrize_with_fixtures.rst index e18887a64..4b6f21c03 100644 --- a/doc/en/parametrize_with_fixtures.rst +++ b/doc/en/parametrize_with_fixtures.rst @@ -74,3 +74,19 @@ pytest version 3.0 and higher reports an error if you try to run above code:: Requested fixture 'extra_context' + +Proposed solution +----------------- + +A new function that can be used in modules can be used to dynamically define +fixtures from existing ones. + +.. code-block:: python + + pytest.define_combined_fixture( + name='context', + fixtures=['default_context', 'extra_context'], + ) + +The new fixture ``context`` inherits the scope from the used fixtures. +