Skip to content

Commit

Permalink
pre-commit: upgrade black (#6208)
Browse files Browse the repository at this point in the history
  • Loading branch information
blueyed authored Nov 16, 2019
2 parents 4b7148f + 54a9545 commit e379604
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
exclude: doc/en/example/py2py3/test_py2.py
repos:
- repo: https://github.com/psf/black
rev: 19.3b0
rev: 19.10b0
hooks:
- id: black
args: [--safe, --quiet]
Expand Down
4 changes: 2 additions & 2 deletions src/_pytest/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,13 @@ def directory_arg(path, optname):


# Plugins that cannot be disabled via "-p no:X" currently.
essential_plugins = ( # fmt: off
essential_plugins = (
"mark",
"main",
"runner",
"fixtures",
"helpconfig", # Provides -p.
) # fmt: on
)

default_plugins = essential_plugins + (
"python",
Expand Down
2 changes: 1 addition & 1 deletion src/_pytest/config/argparsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ def _parse_optional(self, arg_string):
options = ", ".join(option for _, option, _ in option_tuples)
self.error(msg % {"option": arg_string, "matches": options})
elif len(option_tuples) == 1:
option_tuple, = option_tuples
(option_tuple,) = option_tuples
return option_tuple
if self._negative_number_matcher.match(arg_string):
if not self._has_negative_number_optionals:
Expand Down
2 changes: 1 addition & 1 deletion src/_pytest/pytester.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ def getfailedcollections(self) -> List[TestReport]:
return self.getfailures("pytest_collectreport")

def listoutcomes(
self
self,
) -> Tuple[List[TestReport], List[TestReport], List[TestReport]]:
passed = []
skipped = []
Expand Down
6 changes: 3 additions & 3 deletions testing/python/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ def test_func(something): pass
assert repr(req).find(req.function.__name__) != -1

def test_request_attributes_method(self, testdir):
item, = testdir.getitems(
(item,) = testdir.getitems(
"""
import pytest
class TestB(object):
Expand Down Expand Up @@ -531,7 +531,7 @@ def test_method(self, something):
pass
"""
)
item1, = testdir.genitems([modcol])
(item1,) = testdir.genitems([modcol])
assert item1.name == "test_method"
arg2fixturedefs = fixtures.FixtureRequest(item1)._arg2fixturedefs
assert len(arg2fixturedefs) == 1
Expand Down Expand Up @@ -781,7 +781,7 @@ def test_second():

def test_request_getmodulepath(self, testdir):
modcol = testdir.getmodulecol("def test_somefunc(): pass")
item, = testdir.genitems([modcol])
(item,) = testdir.genitems([modcol])
req = fixtures.FixtureRequest(item)
assert req.fspath == modcol.fspath

Expand Down
2 changes: 1 addition & 1 deletion testing/python/raises.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def test_match_failure_string_quoting(self):
with pytest.raises(AssertionError) as excinfo:
with pytest.raises(AssertionError, match="'foo"):
raise AssertionError("'bar")
msg, = excinfo.value.args
(msg,) = excinfo.value.args
assert msg == 'Pattern "\'foo" not found in "\'bar"'

def test_raises_match_wrong_type(self):
Expand Down
8 changes: 4 additions & 4 deletions testing/test_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ def test_collect_protocol_single_function(self, testdir):
p = testdir.makepyfile("def test_func(): pass")
id = "::".join([p.basename, "test_func"])
items, hookrec = testdir.inline_genitems(id)
item, = items
(item,) = items
assert item.name == "test_func"
newid = item.nodeid
assert newid == id
Expand Down Expand Up @@ -605,9 +605,9 @@ def test_serialization_byid(self, testdir):
testdir.makepyfile("def test_func(): pass")
items, hookrec = testdir.inline_genitems()
assert len(items) == 1
item, = items
(item,) = items
items2, hookrec = testdir.inline_genitems(item.nodeid)
item2, = items2
(item2,) = items2
assert item2.name == item.name
assert item2.fspath == item.fspath

Expand All @@ -622,7 +622,7 @@ def test_method(self):
arg = p.basename + "::TestClass::test_method"
items, hookrec = testdir.inline_genitems(arg)
assert len(items) == 1
item, = items
(item,) = items
assert item.nodeid.endswith("TestClass::test_method")
# ensure we are reporting the collection of the single test item (#2464)
assert [x.name for x in self.get_reported_items(hookrec)] == ["test_method"]
Expand Down
2 changes: 1 addition & 1 deletion testing/test_mark.py
Original file line number Diff line number Diff line change
Expand Up @@ -1011,7 +1011,7 @@ def test_custom_mark_parametrized(obj_type):
def test_pytest_param_id_requires_string():
with pytest.raises(TypeError) as excinfo:
pytest.param(id=True)
msg, = excinfo.value.args
(msg,) = excinfo.value.args
assert msg == "Expected id to be a string, got <class 'bool'>: True"


Expand Down
2 changes: 1 addition & 1 deletion testing/test_skipping.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def test_func():
)

def test_skipif_class(self, testdir):
item, = testdir.getitems(
(item,) = testdir.getitems(
"""
import pytest
class TestClass(object):
Expand Down
2 changes: 1 addition & 1 deletion testing/test_tmpdir.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ def test_lock_register_cleanup_removal(self, tmp_path):
registry = []
register_cleanup_lock_removal(lock, register=registry.append)

cleanup_func, = registry
(cleanup_func,) = registry

assert lock.is_file()

Expand Down
2 changes: 1 addition & 1 deletion testing/test_unittest.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ def test_hello(self):


def test_testcase_totally_incompatible_exception_info(testdir):
item, = testdir.getitems(
(item,) = testdir.getitems(
"""
from unittest import TestCase
class MyTestCase(TestCase):
Expand Down

0 comments on commit e379604

Please sign in to comment.