-
Notifications
You must be signed in to change notification settings - Fork 112
Expand file tree
/
Copy pathconftest.py
More file actions
61 lines (46 loc) · 1.82 KB
/
conftest.py
File metadata and controls
61 lines (46 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
from typing import Dict, Tuple
import pytest
from monero_client.monero_cmd import MoneroCmd
from ragger.conftest import configuration
###########################
### CONFIGURATION START ###
###########################
MNEMONIC = "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about"
configuration.OPTIONAL.CUSTOM_SEED = MNEMONIC
#########################
### CONFIGURATION END ###
#########################
# Pull all features from the base ragger conftest using the overridden configuration
pytest_plugins = ("ragger.conftest.base_conftest", )
@pytest.fixture()
def monero(backend, debug=False):
monero_client = MoneroCmd(debug, backend)
yield monero_client
_test_failed_incremental: Dict[str, Dict[Tuple[int, ...], str]] = {}
def pytest_runtest_makereport(item, call):
if "incremental" in item.keywords:
if call.excinfo is not None:
cls_name = str(item.cls)
parametrize_index = (
tuple(item.callspec.indices.values())
if hasattr(item, "callspec")
else ()
)
test_name = item.originalname or item.name
_test_failed_incremental.setdefault(cls_name, {}).setdefault(
parametrize_index, test_name
)
def pytest_runtest_setup(item):
if "incremental" in item.keywords:
cls_name = str(item.cls)
if cls_name in _test_failed_incremental:
parametrize_index = (
tuple(item.callspec.indices.values())
if hasattr(item, "callspec")
else ()
)
test_name = _test_failed_incremental[cls_name].get(
parametrize_index, None
)
if test_name is not None:
pytest.xfail("previous test failed ({})".format(test_name))