@@ -2032,63 +2032,6 @@ def test_simple_failure():
20322032 with mock .patch .object (hook , "fnpats" , ["*.py" ]):
20332033 assert hook .find_spec ("file" ) is None
20342034
2035- def test_assert_rewrite_correct_for_conftfest (
2036- self , pytester : Pytester , hook : AssertionRewritingHook , monkeypatch
2037- ) -> None :
2038- """Conftest is always rewritten regardless of the root dir"""
2039- pytester .makeconftest (
2040- """
2041- import pytest
2042- @pytest.fixture
2043- def fix(): return 1
2044- """
2045- )
2046-
2047- rootpath = f"{ os .getcwd ()} /tests"
2048- if not os .path .exists (rootpath ):
2049- mkdir (rootpath )
2050- monkeypatch .setattr (
2051- pytester ._request .config ,
2052- "invocation_params" ,
2053- Config .InvocationParams (
2054- args = (),
2055- plugins = (),
2056- dir = Path (rootpath ),
2057- ),
2058- )
2059- with mock .patch .object (hook , "fnpats" , ["*.py" ]):
2060- assert hook .find_spec ("conftest" ) is not None
2061-
2062- def test_assert_rewrite_correct_for_plugins (
2063- self , pytester : Pytester , hook : AssertionRewritingHook , monkeypatch
2064- ) -> None :
2065- """Plugins has always been rewritten regardless of the root dir"""
2066- pkgdir = pytester .mkpydir ("plugin" )
2067- pkgdir .joinpath ("__init__.py" ).write_text (
2068- "import pytest\n "
2069- "@pytest.fixture\n "
2070- "def special_asserter():\n "
2071- " def special_assert(x, y):\n "
2072- " assert x == y\n "
2073- " return special_assert\n " ,
2074- encoding = "utf-8" ,
2075- )
2076- hook .mark_rewrite ("plugin" )
2077- rootpath = f"{ os .getcwd ()} /tests"
2078- if not os .path .exists (rootpath ):
2079- mkdir (rootpath )
2080- monkeypatch .setattr (
2081- pytester ._request .config ,
2082- "invocation_params" ,
2083- Config .InvocationParams (
2084- args = (),
2085- plugins = (),
2086- dir = Path (rootpath ),
2087- ),
2088- )
2089- with mock .patch .object (hook , "fnpats" , ["*.py" ]):
2090- assert hook .find_spec ("plugin" ) is not None
2091-
20922035 @pytest .mark .skipif (
20932036 sys .platform .startswith ("win32" ), reason = "cannot remove cwd on Windows"
20942037 )
0 commit comments