MCPcopy Create free account
hub / github.com/pytest-dev/pytest / test_autouse_fixture_plugin

Method test_autouse_fixture_plugin

testing/python/fixtures.py:561–583  ·  view source on GitHub ↗
(self, pytester: Pytester)

Source from the content-addressed store, hash-verified

559 result.stdout.fnmatch_lines(["*2 passed*"])
560
561 def test_autouse_fixture_plugin(self, pytester: Pytester) -> None:
562 # A fixture from a plugin has no baseid set, which screwed up
563 # the autouse fixture handling.
564 pytester.makepyfile(
565 testplugin="""
566 import pytest
567
568 @pytest.fixture(autouse=True)
569 def foo(request):
570 request.function.foo = 7
571 """
572 )
573 pytester.syspathinsert()
574 pytester.makepyfile(
575 """
576 pytest_plugins = 'testplugin'
577
578 def test_foo(request):
579 assert request.function.foo == 7
580 """
581 )
582 result = pytester.runpytest()
583 assert result.ret == 0
584
585 def test_funcarg_lookup_error(self, pytester: Pytester) -> None:
586 pytester.makeconftest(

Callers

nothing calls this directly

Calls 3

makepyfileMethod · 0.45
syspathinsertMethod · 0.45
runpytestMethod · 0.45

Tested by

no test coverage detected