File: conftest.py

package info (click to toggle)
deepdiff 8.1.1-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,716 kB
  • sloc: python: 14,702; makefile: 164; sh: 9
file content (104 lines) | stat: -rw-r--r-- 3,571 bytes parent folder | download | duplicates (2)
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
import sys
import os
import json
import pytest

sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), 'tests')))

FIXTURES_DIR = os.path.join(os.path.dirname(__file__), 'tests/fixtures/')


def pytest_addoption(parser):
    parser.addoption(
        "--runslow", action="store_true", default=False, help="run slow tests"
    )


def pytest_configure(config):
    config.addinivalue_line("markers", "slow: mark test as slow to run")


def pytest_collection_modifyitems(config, items):
    if config.getoption("--runslow"):
        # --runslow given in cli: do not skip slow tests
        return
    skip_slow = pytest.mark.skip(reason="need --runslow option to run")
    for item in items:
        if "slow" in item.keywords:
            item.add_marker(skip_slow)


@pytest.fixture(scope='class')
def nested_a_t1():
    with open(os.path.join(FIXTURES_DIR, 'nested_a_t1.json')) as the_file:
        return json.load(the_file)


@pytest.fixture(scope='class')
def nested_a_t2():
    with open(os.path.join(FIXTURES_DIR, 'nested_a_t2.json')) as the_file:
        return json.load(the_file)


@pytest.fixture(scope='class')
def nested_a_result():
    with open(os.path.join(FIXTURES_DIR, 'nested_a_result.json')) as the_file:
        return json.load(the_file)


@pytest.fixture(scope='class')
def nested_a_affected_paths():
    return {
        'root[0][0][2][0][1]', 'root[0][1][1][1][5]', 'root[0][2][1]',
        'root[1][1][2][0][1]', 'root[1][2][0]', 'root[1][2][0][1][5]',
        'root[1][0][2][2][3]', 'root[0][0][1][0][0]', 'root[0][1][0][2][3]',
        'root[0][3][0][2][3]', 'root[0][3][1][0][2]', 'root[1][1][1][0][0]',
        'root[1][0][1][2][1]', 'root[1][0][2][1][2]', 'root[1][3][0][2][3]',
        'root[1][3][1][0][2]', 'root[1][2][0][2]', 'root[1][0][2][0][1]',
        'root[0][3][2][0][1]', 'root[0][3][2][1][0]', 'root[1][3][1][1]',
        'root[1][2][1][1][0]', 'root[1][2][1][0]', 'root[1][0][0][0][2]',
        'root[1][3][2][1][0]', 'root[1][0][0][1][1]', 'root[0][1][2][0]',
        'root[0][1][2][1][0]', 'root[0][2][0][1][2]', 'root[1][3][0][1]',
        'root[0][3][1][1]', 'root[1][2][0][0][2]', 'root[1][3][2][0][1]',
        'root[1][0][1][0]', 'root[1][2][0][0][0]', 'root[1][0][0][0][1]',
        'root[1][3][2][2][2]', 'root[0][1][1][2][1]', 'root[0][1][1][2][2]',
        'root[0][2][0][0][2]', 'root[0][2][0][0][3]', 'root[0][3][1][2][1]',
        'root[0][3][1][2][2]', 'root[1][2][1][2][3]', 'root[1][0][0][1][2]',
        'root[1][0][0][2][1]', 'root[1][3][1][2][1]', 'root[1][3][1][2][2]'
    }


@pytest.fixture(scope='class')
def nested_b_t1():
    with open(os.path.join(FIXTURES_DIR, 'nested_b_t1.json')) as the_file:
        return json.load(the_file)


@pytest.fixture(scope='class')
def nested_b_t2():
    with open(os.path.join(FIXTURES_DIR, 'nested_b_t2.json')) as the_file:
        return json.load(the_file)


@pytest.fixture(scope='class')
def nested_b_result():
    with open(os.path.join(FIXTURES_DIR, 'nested_b_result.json')) as the_file:
        return json.load(the_file)


@pytest.fixture(scope='class')
def compare_func_t1():
    with open(os.path.join(FIXTURES_DIR, 'compare_func_t1.json')) as the_file:
        return json.load(the_file)


@pytest.fixture(scope='class')
def compare_func_t2():
    with open(os.path.join(FIXTURES_DIR, 'compare_func_t2.json')) as the_file:
        return json.load(the_file)


@pytest.fixture(scope='class')
def compare_func_result1():
    with open(os.path.join(FIXTURES_DIR, 'compare_func_result1.json')) as the_file:
        return json.load(the_file)