Skip to content

Commit bdfc5c8

Browse files
Merge pull request #11901 from Pierre-Sassoulas/migrate-from-isort-to-ruff
Migrate from ``autoflake``, ``black``, ``isort``, ``pyupgrade``, ``flake8`` and ``pydocstyle``, to ``ruff``
2 parents 4546d54 + 9ef905e commit bdfc5c8

File tree

150 files changed

+803
-973
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

150 files changed

+803
-973
lines changed

.git-blame-ignore-revs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@ afc607cfd81458d4e4f3b1f3cf8cc931b933907e
2323
5f95dce95602921a70bfbc7d8de2f7712c5e4505
2424
# ran pyupgrade-docs again
2525
75d0b899bbb56d6849e9d69d83a9426ed3f43f8b
26-
2726
# move argument parser to own file
2827
c9df77cbd6a365dcb73c39618e4842711817e871
29-
3028
# Replace reorder-python-imports by isort due to black incompatibility (#11896)
3129
8b54596639f41dfac070030ef20394b9001fe63c
30+
# Run blacken-docs with black's 2024's style
31+
4546d5445aaefe6a03957db028c263521dfb5c4b
32+
# Migration to ruff / ruff format
33+
4588653b2497ed25976b7aaff225b889fb476756

.pre-commit-config.yaml

Lines changed: 10 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
repos:
2-
- repo: https://github.com/psf/black
3-
rev: 24.1.1
4-
hooks:
5-
- id: black
6-
args: [--safe, --quiet]
7-
- repo: https://github.com/asottile/blacken-docs
8-
rev: 1.16.0
9-
hooks:
10-
- id: blacken-docs
11-
additional_dependencies: [black==24.1.1]
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
rev: "v0.1.15"
4+
hooks:
5+
- id: ruff
6+
args: ["--fix"]
7+
- id: ruff-format
128
- repo: https://github.com/pre-commit/pre-commit-hooks
139
rev: v4.5.0
1410
hooks:
@@ -20,33 +16,11 @@ repos:
2016
- id: debug-statements
2117
exclude: _pytest/(debugging|hookspec).py
2218
language_version: python3
23-
- repo: https://github.com/PyCQA/autoflake
24-
rev: v2.2.1
25-
hooks:
26-
- id: autoflake
27-
name: autoflake
28-
args: ["--in-place", "--remove-unused-variables", "--remove-all-unused-imports"]
29-
language: python
30-
files: \.py$
31-
- repo: https://github.com/PyCQA/flake8
32-
rev: 7.0.0
33-
hooks:
34-
- id: flake8
35-
language_version: python3
36-
additional_dependencies:
37-
- flake8-typing-imports==1.12.0
38-
- flake8-docstrings==1.5.0
39-
- repo: https://github.com/pycqa/isort
40-
rev: 5.13.2
41-
hooks:
42-
- id: isort
43-
name: isort
44-
args: [--force-single-line, --profile=black]
45-
- repo: https://github.com/asottile/pyupgrade
46-
rev: v3.15.0
19+
- repo: https://github.com/adamchainz/blacken-docs
20+
rev: 1.16.0
4721
hooks:
48-
- id: pyupgrade
49-
args: [--py38-plus]
22+
- id: blacken-docs
23+
additional_dependencies: [black==24.1.1]
5024
- repo: https://github.com/asottile/setup-cfg-fmt
5125
rev: v2.5.0
5226
hooks:

README.rst

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@
2727
:target: https://results.pre-commit.ci/latest/github/pytest-dev/pytest/main
2828
:alt: pre-commit.ci status
2929

30-
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
31-
:target: https://github.com/psf/black
32-
3330
.. image:: https://www.codetriage.com/pytest-dev/pytest/badges/users.svg
3431
:target: https://www.codetriage.com/pytest-dev/pytest
3532

bench/bench.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import sys
22

3+
34
if __name__ == "__main__":
45
import cProfile
56
import pstats

bench/bench_argcomplete.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# FastFilesCompleter 0.7383 1.0760
55
import timeit
66

7+
78
imports = [
89
"from argcomplete.completers import FilesCompleter as completer",
910
"from _pytest._argcomplete import FastFilesCompleter as completer",

bench/skip.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import pytest
22

3+
34
SKIP = True
45

56

bench/unit_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from unittest import TestCase # noqa: F401
22

3+
34
for i in range(15000):
45
exec(
56
f"""

doc/en/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
from _pytest import __version__ as version
2525

26+
2627
if TYPE_CHECKING:
2728
import sphinx.application
2829

doc/en/example/assertion/global_testmodule_config/conftest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import pytest
44

5+
56
mydir = os.path.dirname(__file__)
67

78

doc/en/example/assertion/test_failures.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import os.path
22
import shutil
33

4+
45
failure_demo = os.path.join(os.path.dirname(__file__), "failure_demo.py")
56
pytest_plugins = ("pytester",)
67

0 commit comments

Comments
 (0)