Skip to content

Latest commit

 

History

History
39 lines (27 loc) · 718 Bytes

PT023.md

File metadata and controls

39 lines (27 loc) · 718 Bytes

PT023

use @pytest.mark.foo over @pytest.mark.foo()

Configuration

  • pytest-mark-no-parentheses
    Boolean flag specifying whether @pytest.mark.foo() without parameters should have parentheses.
    If the option is set to true (the default), @pytest.mark.foo is valid and @pytest.mark.foo() is an error.
    If set to false, @pytest.mark.foo() is valid and @pytest.mark.foo is an error.

Examples

Bad code (assuming pytest-mark-no-parentheses set to true):

import pytest

@pytest.mark.foo()
def test_something():
    ...

Good code:

import pytest

@pytest.mark.foo
def test_something():
    ...

Rationale

  • to enforce consistency between all tests in a codebase