Skip to content

Commit 9e69cd6

Browse files
Rephrase rationale for pytest-incorrect-pytest-import (#11255)
## Summary Closes #11247.
1 parent b90a937 commit 9e69cd6

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

crates/ruff_linter/src/rules/flake8_pytest_style/rules/imports.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ use ruff_text_size::Ranged;
88
/// Checks for incorrect import of pytest.
99
///
1010
/// ## Why is this bad?
11-
/// `pytest` should be imported as `import pytest` and its members should be accessed in the form of
12-
/// `pytest.xxx.yyy` for consistency and to make it easier for linting tools to analyze the code.
11+
/// For consistency, `pytest` should be imported as `import pytest` and its members should be
12+
/// accessed in the form of `pytest.xxx.yyy` for consistency
1313
///
1414
/// ## Example
1515
/// ```python
@@ -27,7 +27,7 @@ pub struct PytestIncorrectPytestImport;
2727
impl Violation for PytestIncorrectPytestImport {
2828
#[derive_message_formats]
2929
fn message(&self) -> String {
30-
format!("Found incorrect import of pytest, use simple `import pytest` instead")
30+
format!("Incorrect import of `pytest`; use `import pytest` instead")
3131
}
3232
}
3333

Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs
33
---
4-
PT013.py:11:1: PT013 Found incorrect import of pytest, use simple `import pytest` instead
4+
PT013.py:11:1: PT013 Incorrect import of `pytest`; use `import pytest` instead
55
|
66
9 | # Error
77
10 |
@@ -11,20 +11,18 @@ PT013.py:11:1: PT013 Found incorrect import of pytest, use simple `import pytest
1111
13 | from pytest import fixture as other_name
1212
|
1313

14-
PT013.py:12:1: PT013 Found incorrect import of pytest, use simple `import pytest` instead
14+
PT013.py:12:1: PT013 Incorrect import of `pytest`; use `import pytest` instead
1515
|
1616
11 | import pytest as other_name
1717
12 | from pytest import fixture
1818
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ PT013
1919
13 | from pytest import fixture as other_name
2020
|
2121

22-
PT013.py:13:1: PT013 Found incorrect import of pytest, use simple `import pytest` instead
22+
PT013.py:13:1: PT013 Incorrect import of `pytest`; use `import pytest` instead
2323
|
2424
11 | import pytest as other_name
2525
12 | from pytest import fixture
2626
13 | from pytest import fixture as other_name
2727
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PT013
2828
|
29-
30-

0 commit comments

Comments
 (0)