Skip to content

Commit

Permalink
👹 Feed the hobgoblins (delint).
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Jul 19, 2024
1 parent 934aa9b commit 4f51b3a
Showing 1 changed file with 34 additions and 51 deletions.
85 changes: 34 additions & 51 deletions tests/test_flake8.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Unit tests for flake8 pytest plugin."""


import pathlib

import py
Expand Down Expand Up @@ -54,13 +53,11 @@ def test_default_flake8_ignores(self, testdir):
testdir.tmpdir.ensure("tests/hello.py")
result = testdir.runpytest("--flake8", "-s")
result.assert_outcomes(passed=2)
result.stdout.fnmatch_lines(
[
"*collected 2*",
"*xy.py .*",
"*2 passed*",
]
)
result.stdout.fnmatch_lines([
"*collected 2*",
"*xy.py .*",
"*2 passed*",
])

def test_ignores_all(self, testdir):
"""Verify success when all errors are ignored."""
Expand All @@ -75,49 +72,41 @@ def test_ignores_all(self, testdir):
testdir.tmpdir.ensure("tests/hello.py")
result = testdir.runpytest("--flake8", "-s")
result.assert_outcomes(passed=1)
result.stdout.fnmatch_lines(
[
"*collected 1*",
"*xy.py .*",
"*1 passed*",
]
)
result.stdout.fnmatch_lines([
"*collected 1*",
"*xy.py .*",
"*1 passed*",
])

def test_w293w292(self, testdir, example):
result = testdir.runpytest(
"--flake8",
)
result.stdout.fnmatch_lines(
[
# "*plugins*flake8*",
"*W293*",
"*W292*",
]
)
result.stdout.fnmatch_lines([
# "*plugins*flake8*",
"*W293*",
"*W292*",
])
result.assert_outcomes(failed=1)

def test_mtime_caching(self, testdir, example):
testdir.tmpdir.ensure("hello.py")
result = testdir.runpytest(
"--flake8",
)
result.stdout.fnmatch_lines(
[
# "*plugins*flake8*",
"*W293*",
"*W292*",
]
)
result.stdout.fnmatch_lines([
# "*plugins*flake8*",
"*W293*",
"*W292*",
])
result.assert_outcomes(passed=1, failed=1)
result = testdir.runpytest(
"--flake8",
)
result.stdout.fnmatch_lines(
[
"*W293*",
"*W292*",
]
)
result.stdout.fnmatch_lines([
"*W293*",
"*W292*",
])
result.assert_outcomes(skipped=1, failed=1)
testdir.makeini("""
[pytest]
Expand All @@ -144,11 +133,9 @@ def f():
""",
)
result = testdir.runpytest("--flake8")
result.stdout.fnmatch_lines(
[
"*collected 1*",
]
)
result.stdout.fnmatch_lines([
"*collected 1*",
])
result.assert_outcomes(failed=1)


Expand All @@ -159,11 +146,9 @@ class AClass:
""")
p = p.write(p.read() + "\n")
result = testdir.runpytest("--flake8", "--verbose")
result.stdout.fnmatch_lines(
[
"*test_ok_verbose*",
]
)
result.stdout.fnmatch_lines([
"*test_ok_verbose*",
])
result.assert_outcomes(passed=1)


Expand All @@ -174,12 +159,10 @@ def test_hello():
#
""")
result = testdir.runpytest("--flake8", "-mflake8")
result.stdout.fnmatch_lines(
[
"*E201*",
"*1 failed*",
]
)
result.stdout.fnmatch_lines([
"*E201*",
"*1 failed*",
])
result.assert_outcomes(failed=1)


Expand Down

0 comments on commit 4f51b3a

Please sign in to comment.