@@ -373,6 +373,7 @@ def test_rewrites_plugin_as_a_package(self, pytester: Pytester) -> None:
373
373
pytester .makeconftest ('pytest_plugins = ["plugin"]' )
374
374
pytester .makepyfile ("def test(special_asserter): special_asserter(1, 2)\n " )
375
375
result = pytester .runpytest ()
376
+
376
377
result .stdout .fnmatch_lines (["*assert 1 == 2*" ])
377
378
378
379
def test_honors_pep_235 (self , pytester : Pytester , monkeypatch ) -> None :
@@ -1999,11 +2000,11 @@ def test_simple_failure():
1999
2000
assert hook .find_spec ("file" ) is None
2000
2001
2001
2002
2002
- def test_assert_correct_for_conftfest (
2003
+ def test_assert_rewrite_correct_for_conftfest (
2003
2004
self , pytester : Pytester , hook : AssertionRewritingHook , monkeypatch
2004
2005
) -> None :
2005
2006
"""
2006
- Conftest is always rewritten regardless of the working dir
2007
+ Conftest is always rewritten regardless of the root dir
2007
2008
"""
2008
2009
pytester .makeconftest (
2009
2010
"""
@@ -2022,9 +2023,12 @@ def fix(): return 1
2022
2023
assert hook .find_spec ("conftest" ) is not None
2023
2024
2024
2025
2025
- def test_assert_excluded_rewrite_for_plugins (
2026
+ def test_assert_rewrite_correct_for_plugins (
2026
2027
self , pytester : Pytester , hook : AssertionRewritingHook , monkeypatch
2027
2028
) -> None :
2029
+ """
2030
+ Plugins has always been rewritten regardless of the root dir
2031
+ """
2028
2032
pkgdir = pytester .mkpydir ("plugin" )
2029
2033
pkgdir .joinpath ("__init__.py" ).write_text (
2030
2034
"import pytest\n "
@@ -2035,10 +2039,10 @@ def test_assert_excluded_rewrite_for_plugins(
2035
2039
" return special_assert\n " ,
2036
2040
encoding = "utf-8" ,
2037
2041
)
2038
- pytester . makeconftest ( 'pytest_plugins = [ "plugin"]' )
2042
+ hook . mark_rewrite ( "plugin" )
2039
2043
rootpath = f"{ os .getcwd ()} /tests"
2040
2044
if not os .path .exists (rootpath ):
2041
- mkdir (rootpath )
2045
+ mkdir (rootpath )
2042
2046
monkeypatch .chdir (rootpath )
2043
2047
with mock .patch .object (hook , "fnpats" , ["*.py" ]):
2044
2048
assert hook .find_spec ("plugin" ) is not None
0 commit comments