Merge pull request #4109 from njonesu/master

Fix multiple string literals on a line #4093
This commit is contained in:
Bruno Oliveira 2018-10-11 15:50:08 -03:00 committed by GitHub
commit 0f5263cdc3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 21 additions and 24 deletions

View File

@ -0,0 +1 @@
Fixed formatting of string literals in internal tests.

View File

@ -245,9 +245,9 @@ class TestCustomAssertMsg(object):
a = 1
b = 2
assert A.a == b, (
"A.a appears not to be b\n" "or does not appear to be b\none of those"
)
assert (
A.a == b
), "A.a appears not to be b\nor does not appear to be b\none of those"
def test_custom_repr(self):
class JSON(object):

View File

@ -582,7 +582,7 @@ get on the terminal - we are working on that)::
b = 2
> assert (
A.a == b
), "A.a appears not to be b\n" "or does not appear to be b\none of those"
), "A.a appears not to be b\nor does not appear to be b\none of those"
E AssertionError: A.a appears not to be b
E or does not appear to be b
E one of those

View File

@ -199,7 +199,7 @@ def _diff_text(left, right, verbose=False):
if i > 42:
i -= 10 # Provide some context
explanation = [
u("Skipping %s identical leading " "characters in diff, use -v to show")
u("Skipping %s identical leading characters in diff, use -v to show")
% i
]
left = left[i:]

View File

@ -344,7 +344,7 @@ def cacheshow(config, session):
key = valpath.relative_to(vdir)
val = config.cache.get(key, dummy)
if val is dummy:
tw.line("%s contains unreadable content, " "will be ignored" % key)
tw.line("%s contains unreadable content, will be ignored" % key)
else:
tw.line("%s contains:" % key)
for line in pformat(val).splitlines():

View File

@ -654,7 +654,7 @@ class DontReadFromInput(six.Iterator):
return self
def fileno(self):
raise UnsupportedOperation("redirected stdin is pseudofile, " "has no fileno()")
raise UnsupportedOperation("redirected stdin is pseudofile, has no fileno()")
def isatty(self):
return False

View File

@ -275,7 +275,7 @@ def get_real_func(obj):
obj = new_obj
else:
raise ValueError(
("could not find real function of {start}" "\nstopped at {current}").format(
("could not find real function of {start}\nstopped at {current}").format(
start=py.io.saferepr(start_obj), current=py.io.saferepr(obj)
)
)

View File

@ -64,7 +64,7 @@ RECORD_XML_PROPERTY = RemovedInPytest4Warning(
)
COLLECTOR_MAKEITEM = RemovedInPytest4Warning(
"pycollector makeitem was removed " "as it is an accidentially leaked internal api"
"pycollector makeitem was removed as it is an accidentially leaked internal api"
)
METAFUNC_ADD_CALL = RemovedInPytest4Warning(

View File

@ -139,7 +139,7 @@ def showhelp(config):
tw.line()
tw.line()
tw.line(
"[pytest] ini-options in the first " "pytest.ini|tox.ini|setup.cfg file found:"
"[pytest] ini-options in the first pytest.ini|tox.ini|setup.cfg file found:"
)
tw.line()

View File

@ -131,7 +131,7 @@ def pytest_addoption(parser):
"python_functions",
type="args",
default=["test"],
help="prefixes or glob names for Python test function and " "method discovery",
help="prefixes or glob names for Python test function and method discovery",
)
group.addoption(

View File

@ -196,7 +196,7 @@ class WarningsChecker(WarningsRecorder):
def __init__(self, expected_warning=None, match_expr=None):
super(WarningsChecker, self).__init__()
msg = "exceptions must be old-style classes or " "derived from Warning, not %s"
msg = "exceptions must be old-style classes or derived from Warning, not %s"
if isinstance(expected_warning, tuple):
for exc in expected_warning:
if not inspect.isclass(exc):

View File

@ -835,9 +835,7 @@ def repr_pythonversion(v=None):
def build_summary_stats_line(stats):
keys = (
"failed passed skipped deselected " "xfailed xpassed warnings error"
).split()
keys = ("failed passed skipped deselected xfailed xpassed warnings error").split()
unknown_key_seen = False
for key in stats.keys():
if key not in keys:

View File

@ -608,7 +608,7 @@ class TestInvocationVariants(object):
lib = ns.mkdir(dirname)
lib.ensure("__init__.py")
lib.join("test_{}.py".format(dirname)).write(
"def test_{}(): pass\n" "def test_other():pass".format(dirname)
"def test_{}(): pass\ndef test_other():pass".format(dirname)
)
# The structure of the test directory is now:
@ -697,10 +697,10 @@ class TestInvocationVariants(object):
lib = foo.mkdir("bar")
lib.ensure("__init__.py")
lib.join("test_bar.py").write(
"def test_bar(): pass\n" "def test_other(a_fixture):pass"
"def test_bar(): pass\ndef test_other(a_fixture):pass"
)
lib.join("conftest.py").write(
"import pytest\n" "@pytest.fixture\n" "def a_fixture():pass"
"import pytest\n@pytest.fixture\ndef a_fixture():pass"
)
d_local = testdir.mkdir("local")

View File

@ -26,10 +26,10 @@ def test_coloredlogformatter():
formatter = ColoredLevelFormatter(tw, logfmt)
output = formatter.format(record)
assert output == (
"dummypath 10 " "\x1b[32mINFO \x1b[0m Test Message"
"dummypath 10 \x1b[32mINFO \x1b[0m Test Message"
)
tw.hasmarkup = False
formatter = ColoredLevelFormatter(tw, logfmt)
output = formatter.format(record)
assert output == ("dummypath 10 " "INFO Test Message")
assert output == ("dummypath 10 INFO Test Message")

View File

@ -476,7 +476,7 @@ class TestPython(object):
tnode.assert_attr(
file="test_junit_prefixing.py",
line="3",
classname="xyz.test_junit_prefixing." "TestHello",
classname="xyz.test_junit_prefixing.TestHello",
name="test_hello",
)

View File

@ -281,9 +281,7 @@ class TestPDB(object):
assert False
"""
)
child = testdir.spawn_pytest(
"--show-capture=all --pdb " "-p no:logging %s" % p1
)
child = testdir.spawn_pytest("--show-capture=all --pdb -p no:logging %s" % p1)
child.expect("get rekt")
output = child.before.decode("utf8")
assert "captured log" not in output