summaryrefslogtreecommitdiff
path: root/testing
diff options
context:
space:
mode:
authorpre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>2020-12-30 11:56:09 +0200
committerGitHub <noreply@github.com>2020-12-30 11:56:09 +0200
commitee03e31831900c3a7aba9f94a9693a833a3ab9de (patch)
tree431d7984ce45526a5403316fddafac12171cd25c /testing
parent77519048753f629847d3edaf8344753ad6689ada (diff)
downloadpytest-ee03e31831900c3a7aba9f94a9693a833a3ab9de.tar.gz
[pre-commit.ci] pre-commit autoupdate (#8201)
* [pre-commit.ci] pre-commit autoupdate * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * manual fixes after configuration update * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Anthony Sottile <asottile@umich.edu>
Diffstat (limited to 'testing')
-rw-r--r--testing/example_scripts/dataclasses/test_compare_recursive_dataclasses.py10
-rw-r--r--testing/io/test_terminalwriter.py15
-rw-r--r--testing/python/approx.py3
-rw-r--r--testing/python/metafunc.py10
-rw-r--r--testing/test_capture.py3
-rw-r--r--testing/test_debugging.py4
-rw-r--r--testing/test_doctest.py4
-rw-r--r--testing/test_mark.py13
-rw-r--r--testing/test_mark_expression.py18
-rw-r--r--testing/test_monkeypatch.py4
-rw-r--r--testing/test_pluginmanager.py4
-rw-r--r--testing/test_runner_xunit.py4
-rw-r--r--testing/test_stepwise.py7
-rw-r--r--testing/test_warnings.py2
14 files changed, 79 insertions, 22 deletions
diff --git a/testing/example_scripts/dataclasses/test_compare_recursive_dataclasses.py b/testing/example_scripts/dataclasses/test_compare_recursive_dataclasses.py
index 167140e16..0945790f0 100644
--- a/testing/example_scripts/dataclasses/test_compare_recursive_dataclasses.py
+++ b/testing/example_scripts/dataclasses/test_compare_recursive_dataclasses.py
@@ -29,10 +29,16 @@ class C3:
def test_recursive_dataclasses():
left = C3(
- S(10, "ten"), C2(C(S(1, "one"), S(2, "two")), S(2, "three")), "equal", "left",
+ S(10, "ten"),
+ C2(C(S(1, "one"), S(2, "two")), S(2, "three")),
+ "equal",
+ "left",
)
right = C3(
- S(20, "xxx"), C2(C(S(1, "one"), S(2, "yyy")), S(3, "three")), "equal", "right",
+ S(20, "xxx"),
+ C2(C(S(1, "one"), S(2, "yyy")), S(3, "three")),
+ "equal",
+ "right",
)
assert left == right
diff --git a/testing/io/test_terminalwriter.py b/testing/io/test_terminalwriter.py
index fac7593ea..4866c94a5 100644
--- a/testing/io/test_terminalwriter.py
+++ b/testing/io/test_terminalwriter.py
@@ -258,13 +258,22 @@ class TestTerminalWriterLineWidth:
id="with markup and code_highlight",
),
pytest.param(
- True, False, "assert 0\n", id="with markup but no code_highlight",
+ True,
+ False,
+ "assert 0\n",
+ id="with markup but no code_highlight",
),
pytest.param(
- False, True, "assert 0\n", id="without markup but with code_highlight",
+ False,
+ True,
+ "assert 0\n",
+ id="without markup but with code_highlight",
),
pytest.param(
- False, False, "assert 0\n", id="neither markup nor code_highlight",
+ False,
+ False,
+ "assert 0\n",
+ id="neither markup nor code_highlight",
),
],
)
diff --git a/testing/python/approx.py b/testing/python/approx.py
index e76d6b774..db6124e39 100644
--- a/testing/python/approx.py
+++ b/testing/python/approx.py
@@ -514,7 +514,8 @@ class TestApprox:
)
def test_expected_value_type_error(self, x, name):
with pytest.raises(
- TypeError, match=fr"pytest.approx\(\) does not support nested {name}:",
+ TypeError,
+ match=fr"pytest.approx\(\) does not support nested {name}:",
):
approx(x)
diff --git a/testing/python/metafunc.py b/testing/python/metafunc.py
index 58a902a3a..6577ff18e 100644
--- a/testing/python/metafunc.py
+++ b/testing/python/metafunc.py
@@ -514,7 +514,10 @@ class TestMetafunc:
]
for config, expected in values:
result = idmaker(
- ("a",), [pytest.param("string")], idfn=lambda _: "ação", config=config,
+ ("a",),
+ [pytest.param("string")],
+ idfn=lambda _: "ação",
+ config=config,
)
assert result == [expected]
@@ -546,7 +549,10 @@ class TestMetafunc:
]
for config, expected in values:
result = idmaker(
- ("a",), [pytest.param("string")], ids=["ação"], config=config,
+ ("a",),
+ [pytest.param("string")],
+ ids=["ação"],
+ config=config,
)
assert result == [expected]
diff --git a/testing/test_capture.py b/testing/test_capture.py
index 3a5c617fe..4d89f0b9e 100644
--- a/testing/test_capture.py
+++ b/testing/test_capture.py
@@ -1431,7 +1431,8 @@ def test_error_attribute_issue555(pytester: Pytester) -> None:
@pytest.mark.skipif(
- not sys.platform.startswith("win"), reason="only on windows",
+ not sys.platform.startswith("win"),
+ reason="only on windows",
)
def test_py36_windowsconsoleio_workaround_non_standard_streams() -> None:
"""
diff --git a/testing/test_debugging.py b/testing/test_debugging.py
index e1b57299d..9cdd41166 100644
--- a/testing/test_debugging.py
+++ b/testing/test_debugging.py
@@ -877,7 +877,9 @@ class TestPDB:
assert custom_pdb_calls == []
def test_pdb_custom_cls_with_set_trace(
- self, pytester: Pytester, monkeypatch: MonkeyPatch,
+ self,
+ pytester: Pytester,
+ monkeypatch: MonkeyPatch,
) -> None:
pytester.makepyfile(
custom_pdb="""
diff --git a/testing/test_doctest.py b/testing/test_doctest.py
index 08d0aacf6..b63665349 100644
--- a/testing/test_doctest.py
+++ b/testing/test_doctest.py
@@ -69,7 +69,9 @@ class TestDoctests:
@pytest.mark.parametrize("filename", ["__init__", "whatever"])
def test_collect_module_two_doctest_no_modulelevel(
- self, pytester: Pytester, filename: str,
+ self,
+ pytester: Pytester,
+ filename: str,
) -> None:
path = pytester.makepyfile(
**{
diff --git a/testing/test_mark.py b/testing/test_mark.py
index 5f4b3e063..420faf91e 100644
--- a/testing/test_mark.py
+++ b/testing/test_mark.py
@@ -356,8 +356,14 @@ def test_parametrize_with_module(pytester: Pytester) -> None:
"foo or or",
"at column 8: expected not OR left parenthesis OR identifier; got or",
),
- ("(foo", "at column 5: expected right parenthesis; got end of input",),
- ("foo bar", "at column 5: expected end of input; got identifier",),
+ (
+ "(foo",
+ "at column 5: expected right parenthesis; got end of input",
+ ),
+ (
+ "foo bar",
+ "at column 5: expected end of input; got identifier",
+ ),
(
"or or",
"at column 1: expected not OR left parenthesis OR identifier; got or",
@@ -863,7 +869,8 @@ class TestKeywordSelection:
assert passed + skipped + failed == 0
@pytest.mark.parametrize(
- "keyword", ["__", "+", ".."],
+ "keyword",
+ ["__", "+", ".."],
)
def test_no_magic_values(self, pytester: Pytester, keyword: str) -> None:
"""Make sure the tests do not match on magic values,
diff --git a/testing/test_mark_expression.py b/testing/test_mark_expression.py
index faca02d93..d37324f51 100644
--- a/testing/test_mark_expression.py
+++ b/testing/test_mark_expression.py
@@ -70,7 +70,11 @@ def test_syntax_oddeties(expr: str, expected: bool) -> None:
("expr", "column", "message"),
(
("(", 2, "expected not OR left parenthesis OR identifier; got end of input"),
- (" (", 3, "expected not OR left parenthesis OR identifier; got end of input",),
+ (
+ " (",
+ 3,
+ "expected not OR left parenthesis OR identifier; got end of input",
+ ),
(
")",
1,
@@ -81,7 +85,11 @@ def test_syntax_oddeties(expr: str, expected: bool) -> None:
1,
"expected not OR left parenthesis OR identifier; got right parenthesis",
),
- ("not", 4, "expected not OR left parenthesis OR identifier; got end of input",),
+ (
+ "not",
+ 4,
+ "expected not OR left parenthesis OR identifier; got end of input",
+ ),
(
"not not",
8,
@@ -98,7 +106,11 @@ def test_syntax_oddeties(expr: str, expected: bool) -> None:
10,
"expected not OR left parenthesis OR identifier; got end of input",
),
- ("ident and or", 11, "expected not OR left parenthesis OR identifier; got or",),
+ (
+ "ident and or",
+ 11,
+ "expected not OR left parenthesis OR identifier; got or",
+ ),
("ident ident", 7, "expected end of input; got identifier"),
),
)
diff --git a/testing/test_monkeypatch.py b/testing/test_monkeypatch.py
index 0b97a0e5a..955218180 100644
--- a/testing/test_monkeypatch.py
+++ b/testing/test_monkeypatch.py
@@ -348,7 +348,9 @@ class SampleInherit(Sample):
@pytest.mark.parametrize(
- "Sample", [Sample, SampleInherit], ids=["new", "new-inherit"],
+ "Sample",
+ [Sample, SampleInherit],
+ ids=["new", "new-inherit"],
)
def test_issue156_undo_staticmethod(Sample: Type[Sample]) -> None:
monkeypatch = MonkeyPatch()
diff --git a/testing/test_pluginmanager.py b/testing/test_pluginmanager.py
index a5282a507..9835b24a0 100644
--- a/testing/test_pluginmanager.py
+++ b/testing/test_pluginmanager.py
@@ -346,7 +346,9 @@ class TestPytestPluginManager:
assert mod.x == 3
def test_consider_conftest_deps(
- self, pytester: Pytester, pytestpm: PytestPluginManager,
+ self,
+ pytester: Pytester,
+ pytestpm: PytestPluginManager,
) -> None:
mod = import_path(pytester.makepyfile("pytest_plugins='xyz'"))
with pytest.raises(ImportError):
diff --git a/testing/test_runner_xunit.py b/testing/test_runner_xunit.py
index e90d761f6..e077ac41e 100644
--- a/testing/test_runner_xunit.py
+++ b/testing/test_runner_xunit.py
@@ -242,7 +242,9 @@ def test_setup_funcarg_setup_when_outer_scope_fails(pytester: Pytester) -> None:
@pytest.mark.parametrize("arg", ["", "arg"])
def test_setup_teardown_function_level_with_optional_argument(
- pytester: Pytester, monkeypatch, arg: str,
+ pytester: Pytester,
+ monkeypatch,
+ arg: str,
) -> None:
"""Parameter to setup/teardown xunit-style functions parameter is now optional (#1728)."""
import sys
diff --git a/testing/test_stepwise.py b/testing/test_stepwise.py
index ff2ec16b7..85489fce8 100644
--- a/testing/test_stepwise.py
+++ b/testing/test_stepwise.py
@@ -138,7 +138,12 @@ def test_fail_and_continue_with_stepwise(stepwise_pytester: Pytester) -> None:
@pytest.mark.parametrize("stepwise_skip", ["--stepwise-skip", "--sw-skip"])
def test_run_with_skip_option(stepwise_pytester: Pytester, stepwise_skip: str) -> None:
result = stepwise_pytester.runpytest(
- "-v", "--strict-markers", "--stepwise", stepwise_skip, "--fail", "--fail-last",
+ "-v",
+ "--strict-markers",
+ "--stepwise",
+ stepwise_skip,
+ "--fail",
+ "--fail-last",
)
assert _strip_resource_warnings(result.stderr.lines) == []
diff --git a/testing/test_warnings.py b/testing/test_warnings.py
index 574f3f1ec..8c9c227b2 100644
--- a/testing/test_warnings.py
+++ b/testing/test_warnings.py
@@ -662,7 +662,7 @@ class TestStackLevel:
class CapturedWarnings:
captured: List[
Tuple[warnings.WarningMessage, Optional[Tuple[str, int, str]]]
- ] = ([])
+ ] = []
@classmethod
def pytest_warning_recorded(cls, warning_message, when, nodeid, location):