Skip to content

Commit

Permalink
Rephrase rationale for pytest-incorrect-pytest-import (#11255)
Browse files Browse the repository at this point in the history
## Summary

Closes #11247.
  • Loading branch information
charliermarsh committed May 3, 2024
1 parent b90a937 commit 9e69cd6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ use ruff_text_size::Ranged;
/// Checks for incorrect import of pytest.
///
/// ## Why is this bad?
/// `pytest` should be imported as `import pytest` and its members should be accessed in the form of
/// `pytest.xxx.yyy` for consistency and to make it easier for linting tools to analyze the code.
/// For consistency, `pytest` should be imported as `import pytest` and its members should be
/// accessed in the form of `pytest.xxx.yyy` for consistency
///
/// ## Example
/// ```python
Expand All @@ -27,7 +27,7 @@ pub struct PytestIncorrectPytestImport;
impl Violation for PytestIncorrectPytestImport {
#[derive_message_formats]
fn message(&self) -> String {
format!("Found incorrect import of pytest, use simple `import pytest` instead")
format!("Incorrect import of `pytest`; use `import pytest` instead")
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs
---
PT013.py:11:1: PT013 Found incorrect import of pytest, use simple `import pytest` instead
PT013.py:11:1: PT013 Incorrect import of `pytest`; use `import pytest` instead
|
9 | # Error
10 |
Expand All @@ -11,20 +11,18 @@ PT013.py:11:1: PT013 Found incorrect import of pytest, use simple `import pytest
13 | from pytest import fixture as other_name
|

PT013.py:12:1: PT013 Found incorrect import of pytest, use simple `import pytest` instead
PT013.py:12:1: PT013 Incorrect import of `pytest`; use `import pytest` instead
|
11 | import pytest as other_name
12 | from pytest import fixture
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ PT013
13 | from pytest import fixture as other_name
|

PT013.py:13:1: PT013 Found incorrect import of pytest, use simple `import pytest` instead
PT013.py:13:1: PT013 Incorrect import of `pytest`; use `import pytest` instead
|
11 | import pytest as other_name
12 | from pytest import fixture
13 | from pytest import fixture as other_name
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PT013
|


0 comments on commit 9e69cd6

Please sign in to comment.