@@ -371,6 +371,7 @@ def test_rewrites_plugin_as_a_package(self, pytester: Pytester) -> None:
371
371
pytester .makeconftest ('pytest_plugins = ["plugin"]' )
372
372
pytester .makepyfile ("def test(special_asserter): special_asserter(1, 2)\n " )
373
373
result = pytester .runpytest ()
374
+
374
375
result .stdout .fnmatch_lines (["*assert 1 == 2*" ])
375
376
376
377
def test_honors_pep_235 (self , pytester : Pytester , monkeypatch ) -> None :
@@ -1981,11 +1982,11 @@ def test_simple_failure():
1981
1982
assert hook .find_spec ("file" ) is None
1982
1983
1983
1984
1984
- def test_assert_correct_for_conftfest (
1985
+ def test_assert_rewrite_correct_for_conftfest (
1985
1986
self , pytester : Pytester , hook : AssertionRewritingHook , monkeypatch
1986
1987
) -> None :
1987
1988
"""
1988
- Conftest is always rewritten regardless of the working dir
1989
+ Conftest is always rewritten regardless of the root dir
1989
1990
"""
1990
1991
pytester .makeconftest (
1991
1992
"""
@@ -2004,9 +2005,12 @@ def fix(): return 1
2004
2005
assert hook .find_spec ("conftest" ) is not None
2005
2006
2006
2007
2007
- def test_assert_excluded_rewrite_for_plugins (
2008
+ def test_assert_rewrite_correct_for_plugins (
2008
2009
self , pytester : Pytester , hook : AssertionRewritingHook , monkeypatch
2009
2010
) -> None :
2011
+ """
2012
+ Plugins has always been rewritten regardless of the root dir
2013
+ """
2010
2014
pkgdir = pytester .mkpydir ("plugin" )
2011
2015
pkgdir .joinpath ("__init__.py" ).write_text (
2012
2016
"import pytest\n "
@@ -2017,10 +2021,10 @@ def test_assert_excluded_rewrite_for_plugins(
2017
2021
" return special_assert\n " ,
2018
2022
encoding = "utf-8" ,
2019
2023
)
2020
- pytester . makeconftest ( 'pytest_plugins = [ "plugin"]' )
2024
+ hook . mark_rewrite ( "plugin" )
2021
2025
rootpath = f"{ os .getcwd ()} /tests"
2022
2026
if not os .path .exists (rootpath ):
2023
- mkdir (rootpath )
2027
+ mkdir (rootpath )
2024
2028
monkeypatch .chdir (rootpath )
2025
2029
with mock .patch .object (hook , "fnpats" , ["*.py" ]):
2026
2030
assert hook .find_spec ("plugin" ) is not None
0 commit comments