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 Dec 15, 2024
1 parent f44947f commit 0dadd7f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
14 changes: 11 additions & 3 deletions pytest_black/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ def pytest_unconfigure(config):

class BlackFile(pytest.File):
def collect(self):
""" returns a list of children (items and collectors)
for this collection node.
"""returns a list of children (items and collectors)
for this collection node.
"""
yield BlackItem.from_parent(self, name="black")

Expand Down Expand Up @@ -74,7 +74,15 @@ def setup(self):
pytest.skip("file(s) excluded by pyproject.toml")

def runtest(self):
cmd = [sys.executable, "-m", "black", "--check", "--diff", "--quiet", str(self.path)]
cmd = [
sys.executable,
"-m",
"black",
"--check",
"--diff",
"--quiet",
str(self.path),
]
try:
subprocess.run(
cmd, check=True, stdout=subprocess.PIPE, universal_newlines=True
Expand Down
18 changes: 6 additions & 12 deletions tests/test_black.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ def test_help_message(pytester):


def test_fail(pytester):
"""Assert test fails due to single quoted strings
"""
"""Assert test fails due to single quoted strings"""
pytester.makepyfile(
"""
def hello():
Expand All @@ -25,8 +24,7 @@ def hello():


def test_pass(pytester):
"""Assert test passes when no formatting issues are found
"""
"""Assert test passes when no formatting issues are found"""
p = pytester.makepyfile(
"""
def hello():
Expand All @@ -41,8 +39,7 @@ def hello():


def test_mtime_cache(pytester):
"""Assert test is skipped when file hasn't changed
"""
"""Assert test is skipped when file hasn't changed"""
p = pytester.makepyfile(
"""
def hello():
Expand All @@ -69,8 +66,7 @@ def hello():


def test_exclude(pytester):
"""Assert test is skipped if path is excluded even if also included
"""
"""Assert test is skipped if path is excluded even if also included"""
pytester.makepyprojecttoml(
"""
[tool.black]
Expand All @@ -96,8 +92,7 @@ def hello():


def test_exclude_folder(pytester):
"""Assert test is skipped for files in a folder
"""
"""Assert test is skipped for files in a folder"""
pytester.makepyprojecttoml(
"""
[tool.black]
Expand Down Expand Up @@ -132,8 +127,7 @@ def hello():


def test_include(pytester):
"""Assert test is not skipped if path is included but not excluded
"""
"""Assert test is not skipped if path is included but not excluded"""
pytester.makepyprojecttoml(
"""
[tool.black]
Expand Down

0 comments on commit 0dadd7f

Please sign in to comment.