Is there a way to reference (and call into) a pytest fixture from a simple function that itself is not either a test_* function or also a fixture?
known examples that can use fixtures:
1)
def test_mytest( some_cool_pytest_fixture_name, the, rest of, my, args):
blah
blah
some_cool_pytest_fixture_name(args)
blah
2)
@pytest.fixture()
def my_new_fixture( some_cool_pytest_fixture_name, the, rest of, my, args):
blah
blah
some_cool_pytest_fixture_name(args)
blah
I want to be able to do this: 3)
def my_simple_function( the, rest of, my, args):
blah
blah
outright.reference.this.pytest.fixture.some_cool_pytest_fixture_name(args)
blah
NOTE:
from pytest import record_xml_property as property_handler
** E ImportError: cannot import name record_xml_property**
^^^ This in on a system which does have the record_xml_property
My desire is to be able to do something like this:
try:
from pytest import record_xml_property as property_handler
except:
@pytest.fixture()
def property_handler(mykey, myval):
print('{0}={1}'.format(mykey,myval)
^^^ If the above can succeed, then I can always depend on property_handler being there for me as a fixture.