Use ruff instead of black, flake8, autoflake, pyupgrade

Config adapted from pytest.
This commit is contained in:
Ran Benita
2024-04-02 23:23:31 +03:00
parent c01de1c73e
commit 816c9dcda1
15 changed files with 109 additions and 73 deletions

View File

@@ -16,9 +16,9 @@ WAIT_TIMEOUT = 10.0
def check_marshallable(d):
try:
marshal.dumps(d)
except ValueError:
except ValueError as e:
pprint.pprint(d)
raise ValueError("not marshallable")
raise ValueError("not marshallable") from e
class EventCall:
@@ -164,7 +164,7 @@ class TestWorkerInteractor:
worker.sendcommand("runtests_all")
worker.sendcommand("shutdown")
for func in "::test_func", "::test_func2":
for i in range(3): # setup/call/teardown
for _ in range(3): # setup/call/teardown
ev = worker.popevent("testreport")
assert ev.name == "testreport"
rep = unserialize_report(ev.kwargs["data"])
@@ -329,12 +329,10 @@ def test_remote_mainargv(pytester: pytest.Pytester) -> None:
outer_argv = sys.argv
pytester.makepyfile(
"""
f"""
def test_mainargv(request):
assert request.config.workerinput["mainargv"] == {!r}
""".format(
outer_argv
)
assert request.config.workerinput["mainargv"] == {outer_argv!r}
"""
)
result = pytester.runpytest("-n1")
assert result.ret == 0