pre-commit: upgrade black (#6208)

This commit is contained in:
Daniel Hahler 2019-11-16 19:20:12 +01:00 committed by GitHub
commit e3796047c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 17 additions and 17 deletions

View File

@ -1,7 +1,7 @@
exclude: doc/en/example/py2py3/test_py2.py exclude: doc/en/example/py2py3/test_py2.py
repos: repos:
- repo: https://github.com/psf/black - repo: https://github.com/psf/black
rev: 19.3b0 rev: 19.10b0
hooks: hooks:
- id: black - id: black
args: [--safe, --quiet] args: [--safe, --quiet]

View File

@ -131,13 +131,13 @@ def directory_arg(path, optname):
# Plugins that cannot be disabled via "-p no:X" currently. # Plugins that cannot be disabled via "-p no:X" currently.
essential_plugins = ( # fmt: off essential_plugins = (
"mark", "mark",
"main", "main",
"runner", "runner",
"fixtures", "fixtures",
"helpconfig", # Provides -p. "helpconfig", # Provides -p.
) # fmt: on )
default_plugins = essential_plugins + ( default_plugins = essential_plugins + (
"python", "python",

View File

@ -395,7 +395,7 @@ class MyOptionParser(argparse.ArgumentParser):
options = ", ".join(option for _, option, _ in option_tuples) options = ", ".join(option for _, option, _ in option_tuples)
self.error(msg % {"option": arg_string, "matches": options}) self.error(msg % {"option": arg_string, "matches": options})
elif len(option_tuples) == 1: elif len(option_tuples) == 1:
option_tuple, = option_tuples (option_tuple,) = option_tuples
return option_tuple return option_tuple
if self._negative_number_matcher.match(arg_string): if self._negative_number_matcher.match(arg_string):
if not self._has_negative_number_optionals: if not self._has_negative_number_optionals:

View File

@ -312,7 +312,7 @@ class HookRecorder:
return self.getfailures("pytest_collectreport") return self.getfailures("pytest_collectreport")
def listoutcomes( def listoutcomes(
self self,
) -> Tuple[List[TestReport], List[TestReport], List[TestReport]]: ) -> Tuple[List[TestReport], List[TestReport], List[TestReport]]:
passed = [] passed = []
skipped = [] skipped = []

View File

@ -503,7 +503,7 @@ class TestRequestBasic:
assert repr(req).find(req.function.__name__) != -1 assert repr(req).find(req.function.__name__) != -1
def test_request_attributes_method(self, testdir): def test_request_attributes_method(self, testdir):
item, = testdir.getitems( (item,) = testdir.getitems(
""" """
import pytest import pytest
class TestB(object): class TestB(object):
@ -531,7 +531,7 @@ class TestRequestBasic:
pass pass
""" """
) )
item1, = testdir.genitems([modcol]) (item1,) = testdir.genitems([modcol])
assert item1.name == "test_method" assert item1.name == "test_method"
arg2fixturedefs = fixtures.FixtureRequest(item1)._arg2fixturedefs arg2fixturedefs = fixtures.FixtureRequest(item1)._arg2fixturedefs
assert len(arg2fixturedefs) == 1 assert len(arg2fixturedefs) == 1
@ -781,7 +781,7 @@ class TestRequestBasic:
def test_request_getmodulepath(self, testdir): def test_request_getmodulepath(self, testdir):
modcol = testdir.getmodulecol("def test_somefunc(): pass") modcol = testdir.getmodulecol("def test_somefunc(): pass")
item, = testdir.genitems([modcol]) (item,) = testdir.genitems([modcol])
req = fixtures.FixtureRequest(item) req = fixtures.FixtureRequest(item)
assert req.fspath == modcol.fspath assert req.fspath == modcol.fspath

View File

@ -205,7 +205,7 @@ class TestRaises:
with pytest.raises(AssertionError) as excinfo: with pytest.raises(AssertionError) as excinfo:
with pytest.raises(AssertionError, match="'foo"): with pytest.raises(AssertionError, match="'foo"):
raise AssertionError("'bar") raise AssertionError("'bar")
msg, = excinfo.value.args (msg,) = excinfo.value.args
assert msg == 'Pattern "\'foo" not found in "\'bar"' assert msg == 'Pattern "\'foo" not found in "\'bar"'
def test_raises_match_wrong_type(self): def test_raises_match_wrong_type(self):

View File

@ -486,7 +486,7 @@ class TestSession:
p = testdir.makepyfile("def test_func(): pass") p = testdir.makepyfile("def test_func(): pass")
id = "::".join([p.basename, "test_func"]) id = "::".join([p.basename, "test_func"])
items, hookrec = testdir.inline_genitems(id) items, hookrec = testdir.inline_genitems(id)
item, = items (item,) = items
assert item.name == "test_func" assert item.name == "test_func"
newid = item.nodeid newid = item.nodeid
assert newid == id assert newid == id
@ -605,9 +605,9 @@ class TestSession:
testdir.makepyfile("def test_func(): pass") testdir.makepyfile("def test_func(): pass")
items, hookrec = testdir.inline_genitems() items, hookrec = testdir.inline_genitems()
assert len(items) == 1 assert len(items) == 1
item, = items (item,) = items
items2, hookrec = testdir.inline_genitems(item.nodeid) items2, hookrec = testdir.inline_genitems(item.nodeid)
item2, = items2 (item2,) = items2
assert item2.name == item.name assert item2.name == item.name
assert item2.fspath == item.fspath assert item2.fspath == item.fspath
@ -622,7 +622,7 @@ class TestSession:
arg = p.basename + "::TestClass::test_method" arg = p.basename + "::TestClass::test_method"
items, hookrec = testdir.inline_genitems(arg) items, hookrec = testdir.inline_genitems(arg)
assert len(items) == 1 assert len(items) == 1
item, = items (item,) = items
assert item.nodeid.endswith("TestClass::test_method") assert item.nodeid.endswith("TestClass::test_method")
# ensure we are reporting the collection of the single test item (#2464) # 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"] assert [x.name for x in self.get_reported_items(hookrec)] == ["test_method"]

View File

@ -1011,7 +1011,7 @@ def test_markers_from_parametrize(testdir):
def test_pytest_param_id_requires_string(): def test_pytest_param_id_requires_string():
with pytest.raises(TypeError) as excinfo: with pytest.raises(TypeError) as excinfo:
pytest.param(id=True) pytest.param(id=True)
msg, = excinfo.value.args (msg,) = excinfo.value.args
assert msg == "Expected id to be a string, got <class 'bool'>: True" assert msg == "Expected id to be a string, got <class 'bool'>: True"

View File

@ -115,7 +115,7 @@ class TestEvaluator:
) )
def test_skipif_class(self, testdir): def test_skipif_class(self, testdir):
item, = testdir.getitems( (item,) = testdir.getitems(
""" """
import pytest import pytest
class TestClass(object): class TestClass(object):

View File

@ -258,7 +258,7 @@ class TestNumberedDir:
registry = [] registry = []
register_cleanup_lock_removal(lock, register=registry.append) register_cleanup_lock_removal(lock, register=registry.append)
cleanup_func, = registry (cleanup_func,) = registry
assert lock.is_file() assert lock.is_file()

View File

@ -383,7 +383,7 @@ def test_testcase_custom_exception_info(testdir, type):
def test_testcase_totally_incompatible_exception_info(testdir): def test_testcase_totally_incompatible_exception_info(testdir):
item, = testdir.getitems( (item,) = testdir.getitems(
""" """
from unittest import TestCase from unittest import TestCase
class MyTestCase(TestCase): class MyTestCase(TestCase):