diff --git a/pyproject.toml b/pyproject.toml index cf3265efe..e17694723 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -102,6 +102,7 @@ select = [ "UP", # pyupgrade "RUF", # ruff "W", # pycodestyle + "PIE", # flake8-pie ] ignore = [ # bugbear ignore diff --git a/src/_pytest/_py/path.py b/src/_pytest/_py/path.py index 554cb4a67..7701561d9 100644 --- a/src/_pytest/_py/path.py +++ b/src/_pytest/_py/path.py @@ -452,7 +452,7 @@ class LocalPath: def ensure_dir(self, *args): """Ensure the path joined with args is a directory.""" - return self.ensure(*args, **{"dir": True}) + return self.ensure(*args, dir=True) def bestrelpath(self, dest): """Return a string which is a relative path from self diff --git a/testing/test_assertion.py b/testing/test_assertion.py index 2d92128fb..ef4e36644 100644 --- a/testing/test_assertion.py +++ b/testing/test_assertion.py @@ -601,7 +601,7 @@ class TestAssert_reprcompare: def test_list_dont_wrap_strings(self) -> None: long_a = "a" * 10 - l1 = ["a"] + [long_a for _ in range(0, 7)] + l1 = ["a"] + [long_a for _ in range(7)] l2 = ["should not get wrapped"] diff = callequal(l1, l2, verbose=True) assert diff == [ diff --git a/testing/test_config.py b/testing/test_config.py index f2651dbeb..ead693cf4 100644 --- a/testing/test_config.py +++ b/testing/test_config.py @@ -1231,8 +1231,7 @@ def test_plugin_loading_order(pytester: Pytester) -> None: import myplugin assert myplugin.terminal_plugin == [False, True] """, - **{ - "myplugin": """ + myplugin=""" terminal_plugin = [] def pytest_configure(config): @@ -1241,8 +1240,7 @@ def test_plugin_loading_order(pytester: Pytester) -> None: def pytest_sessionstart(session): config = session.config terminal_plugin.append(bool(config.pluginmanager.get_plugin("terminalreporter"))) - """ - }, + """, ) pytester.syspathinsert() result = pytester.runpytest("-p", "myplugin", str(p1)) diff --git a/testing/test_skipping.py b/testing/test_skipping.py index 4391c0642..3f1c83f5b 100644 --- a/testing/test_skipping.py +++ b/testing/test_skipping.py @@ -74,7 +74,7 @@ class TestEvaluation: """@pytest.mark.skipif("not hasattr(os, 'murks')")""", """@pytest.mark.skipif(condition="hasattr(os, 'murks')")""", ] - for i in range(0, 2): + for i in range(2): item = pytester.getitem( f""" import pytest