Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pre-commit.ci] pre-commit autoupdate #419

Merged
merged 2 commits into from
Aug 22, 2023
Merged

Conversation

pre-commit-ci bot and others added 2 commits August 22, 2023 08:39
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.0.284 → v0.0.285](astral-sh/ruff-pre-commit@v0.0.284...v0.0.285)
- [github.com/abravalheri/validate-pyproject: v0.13 → v0.14](abravalheri/validate-pyproject@v0.13...v0.14)
% `ruff rule PT009`
# pytest-unittest-assertion (PT009)

Derived from the **flake8-pytest-style** linter.

Autofix is sometimes available.

## What it does
Checks for uses of assertion methods from the `unittest` module.

## Why is this bad?
To make use of `pytest`'s assertion rewriting, a regular `assert` statement
is preferred over `unittest`'s assertion methods.

## Example
```python
import unittest


class TestFoo(unittest.TestCase):
    def test_foo(self):
        self.assertEqual(a, b)
```

Use instead:
```python
import unittest


class TestFoo(unittest.TestCase):
    def test_foo(self):
        assert a == b
```

## References
- [`pytest` documentation: Assertion introspection details](https://docs.pytest.org/en/7.1.x/how-to/assert.html#assertion-introspection-details)
@cclauss cclauss self-assigned this Aug 22, 2023
@cclauss cclauss merged commit c2fd7f2 into master Aug 22, 2023
8 checks passed
@cclauss cclauss deleted the pre-commit-ci-update-config branch August 22, 2023 09:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant