Projet

Général

Profil

0001-pytest-prevent-redundancy-of-slow-parser-option-6604.patch

Paul Marillonnet, 13 juin 2022 13:58

Télécharger (1,76 ko)

Voir les différences:

Subject: [PATCH 1/3] pytest: prevent redundancy of '--slow' parser option
 (#66043)

 tests/conftest.py      | 17 ++++++++++++-----
 tests_rbac/conftest.py | 17 ++++++++++++-----
 2 files changed, 24 insertions(+), 10 deletions(-)
tests/conftest.py
43 43

  
44 44

  
45 45
def pytest_addoption(parser):
46
    parser.addoption(
47
        "--slow",
48
        action="store_true",
49
        help="run slow tests",
50
    )
46
    options = parser._anonymous.options
47
    present = False
48
    for argument in options:
49
        if '--slow' in argument.names():
50
            present = True
51
            break
52
    if not present:
53
        parser.addoption(
54
            "--slow",
55
            action="store_true",
56
            help="run slow tests",
57
        )
51 58

  
52 59

  
53 60
def pytest_configure(config):
tests_rbac/conftest.py
18 18

  
19 19

  
20 20
def pytest_addoption(parser):
21
    parser.addoption(
22
        "--slow",
23
        action="store_true",
24
        help="run slow tests",
25
    )
21
    options = parser._anonymous.options
22
    present = False
23
    for argument in options:
24
        if '--slow' in argument.names():
25
            present = True
26
            break
27
    if not present:
28
        parser.addoption(
29
            "--slow",
30
            action="store_true",
31
            help="run slow tests",
32
        )
26 33

  
27 34

  
28 35
def pytest_configure(config):
29
-