Skip to content

Commit c396557

Browse files
committed
change if else structure of _warn_bout_missing_assertion
1 parent 72a3911 commit c396557

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/_pytest/config/__init__.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1360,19 +1360,20 @@ def _warn_about_missing_assertion(self, mode: str) -> None:
13601360
if not _assertion_supported():
13611361
from _pytest.warnings import _issue_warning_captured
13621362

1363-
warning_text = (
1364-
"assertions not in test modules or"
1365-
" plugins will be ignored"
1366-
" because assert statements are not executed "
1367-
"by the underlying Python interpreter "
1368-
"(are you using python -O?)\n"
1369-
)
13701363
if mode == "plain":
13711364
warning_text = (
13721365
"ASSERTIONS ARE NOT EXECUTED"
13731366
" and FAILING TESTS WILL PASS. Are you"
13741367
" using python -O?"
13751368
)
1369+
else:
1370+
warning_text = (
1371+
"assertions not in test modules or"
1372+
" plugins will be ignored"
1373+
" because assert statements are not executed "
1374+
"by the underlying Python interpreter "
1375+
"(are you using python -O?)\n"
1376+
)
13761377
_issue_warning_captured(
13771378
PytestConfigWarning(warning_text), self.hook, stacklevel=2,
13781379
)

0 commit comments

Comments
 (0)