Skip to content

Latest commit

 

History

History
39 lines (27 loc) · 719 Bytes

PT023.md

File metadata and controls

39 lines (27 loc) · 719 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 false (the default), @pytest.mark.foo() is valid and @pytest.mark.foo is an error.
    If set to true, @pytest.mark.foo is valid and @pytest.mark.foo() is an error.

Examples

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

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