pytest-sort 1.3.2__tar.gz → 1.3.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pytest_sort-1.3.2/src/pytest_sort.egg-info → pytest_sort-1.3.3}/PKG-INFO +4 -3
- {pytest_sort-1.3.2 → pytest_sort-1.3.3}/README.md +2 -2
- {pytest_sort-1.3.2 → pytest_sort-1.3.3}/pyproject.toml +6 -5
- {pytest_sort-1.3.2 → pytest_sort-1.3.3}/src/pytest_sort/core.py +14 -8
- {pytest_sort-1.3.2 → pytest_sort-1.3.3}/src/pytest_sort/diffcov.py +1 -1
- {pytest_sort-1.3.2 → pytest_sort-1.3.3}/src/pytest_sort/plugin.py +6 -6
- {pytest_sort-1.3.2 → pytest_sort-1.3.3/src/pytest_sort.egg-info}/PKG-INFO +4 -3
- {pytest_sort-1.3.2 → pytest_sort-1.3.3}/src/pytest_sort.egg-info/requires.txt +1 -0
- {pytest_sort-1.3.2 → pytest_sort-1.3.3}/test/test_config.py +5 -5
- {pytest_sort-1.3.2 → pytest_sort-1.3.3}/test/test_core.py +36 -28
- {pytest_sort-1.3.2 → pytest_sort-1.3.3}/LICENSE +0 -0
- {pytest_sort-1.3.2 → pytest_sort-1.3.3}/setup.cfg +0 -0
- {pytest_sort-1.3.2 → pytest_sort-1.3.3}/src/pytest_sort/__init__.py +0 -0
- {pytest_sort-1.3.2 → pytest_sort-1.3.3}/src/pytest_sort/config.py +0 -0
- {pytest_sort-1.3.2 → pytest_sort-1.3.3}/src/pytest_sort/database.py +0 -0
- {pytest_sort-1.3.2 → pytest_sort-1.3.3}/src/pytest_sort.egg-info/SOURCES.txt +0 -0
- {pytest_sort-1.3.2 → pytest_sort-1.3.3}/src/pytest_sort.egg-info/dependency_links.txt +0 -0
- {pytest_sort-1.3.2 → pytest_sort-1.3.3}/src/pytest_sort.egg-info/entry_points.txt +0 -0
- {pytest_sort-1.3.2 → pytest_sort-1.3.3}/src/pytest_sort.egg-info/top_level.txt +0 -0
- {pytest_sort-1.3.2 → pytest_sort-1.3.3}/test/test_database.py +0 -0
- {pytest_sort-1.3.2 → pytest_sort-1.3.3}/test/test_diffcov.py +0 -0
- {pytest_sort-1.3.2 → pytest_sort-1.3.3}/test/test_plugin.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pytest-sort
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.3
|
|
4
4
|
Summary: Tools for sorting test cases
|
|
5
5
|
Author-email: WiredNerd <pbuschmail-pytestsort@yahoo.com>
|
|
6
6
|
Maintainer-email: WiredNerd <pbuschmail-pytestsort@yahoo.com>
|
|
@@ -34,16 +34,17 @@ Classifier: Programming Language :: Python :: 3
|
|
|
34
34
|
Classifier: License :: OSI Approved :: MIT License
|
|
35
35
|
Classifier: Operating System :: OS Independent
|
|
36
36
|
Classifier: Framework :: Pytest
|
|
37
|
-
Requires-Python: >=3.
|
|
37
|
+
Requires-Python: >=3.10
|
|
38
38
|
Description-Content-Type: text/markdown
|
|
39
39
|
License-File: LICENSE
|
|
40
40
|
Requires-Dist: pytest>=7.4.0
|
|
41
41
|
Requires-Dist: whatthepatch>=1.0.5
|
|
42
42
|
Requires-Dist: coverage>=7.3.1
|
|
43
|
+
Requires-Dist: zipp>=3.19.1
|
|
43
44
|
Dynamic: license-file
|
|
44
45
|
|
|
45
46
|
[](https://github.com/WiredNerd/pytest-sort)
|
|
46
|
-
[](https://pypi.org/project/pytest-sort)
|
|
47
48
|
[](https://pypi.org/project/pytest-sort)
|
|
48
49
|
[](https://pypistats.org/packages/pytest-sort)
|
|
49
50
|
[](https://github.com/WiredNerd/pytest-sort/blob/main/LICENSE)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
[](https://github.com/WiredNerd/pytest-sort)
|
|
2
|
-
[](https://pypi.org/project/pytest-sort)
|
|
3
3
|
[](https://pypi.org/project/pytest-sort)
|
|
4
4
|
[](https://pypistats.org/packages/pytest-sort)
|
|
5
5
|
[](https://github.com/WiredNerd/pytest-sort/blob/main/LICENSE)
|
|
@@ -61,4 +61,4 @@ Or by opening an issue: https://github.com/WiredNerd/pytest-sort/issues
|
|
|
61
61
|
|
|
62
62
|
## License
|
|
63
63
|
|
|
64
|
-
The project is licensed under the MIT license.
|
|
64
|
+
The project is licensed under the MIT license.
|
|
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "pytest-sort"
|
|
7
7
|
description = "Tools for sorting test cases"
|
|
8
|
-
version = "1.3.
|
|
8
|
+
version = "1.3.3"
|
|
9
9
|
license = { file = "LICENSE" }
|
|
10
10
|
keywords = [
|
|
11
11
|
"test",
|
|
@@ -24,14 +24,14 @@ maintainers = [
|
|
|
24
24
|
{ name = "WiredNerd", email = "pbuschmail-pytestsort@yahoo.com" },
|
|
25
25
|
]
|
|
26
26
|
readme = "README.md"
|
|
27
|
-
requires-python = ">=3.
|
|
27
|
+
requires-python = ">=3.10"
|
|
28
28
|
classifiers = [
|
|
29
29
|
"Programming Language :: Python :: 3",
|
|
30
30
|
"License :: OSI Approved :: MIT License",
|
|
31
31
|
"Operating System :: OS Independent",
|
|
32
32
|
"Framework :: Pytest",
|
|
33
33
|
]
|
|
34
|
-
dependencies = ["pytest>=7.4.0", "whatthepatch>=1.0.5", "coverage>=7.3.1"]
|
|
34
|
+
dependencies = ["pytest>=7.4.0", "whatthepatch>=1.0.5", "coverage>=7.3.1", "zipp>=3.19.1"]
|
|
35
35
|
|
|
36
36
|
[project.urls]
|
|
37
37
|
"Documentation" = "https://pytest-sort.readthedocs.io/"
|
|
@@ -64,7 +64,7 @@ command_line = "pytest -x --assert=plain -o pythonpath='{PYTHONPATH}' --sort-mod
|
|
|
64
64
|
|
|
65
65
|
[tool.black]
|
|
66
66
|
line-length = 120
|
|
67
|
-
target-version = ['
|
|
67
|
+
target-version = ['py310', 'py311', 'py312', 'py313', 'py314']
|
|
68
68
|
skip-string-normalization = true
|
|
69
69
|
color = true
|
|
70
70
|
|
|
@@ -76,7 +76,7 @@ files = "src"
|
|
|
76
76
|
mypy_path = "src"
|
|
77
77
|
|
|
78
78
|
[tool.ruff]
|
|
79
|
-
target-version = "
|
|
79
|
+
target-version = "py310"
|
|
80
80
|
output-format = "full"
|
|
81
81
|
line-length = 120
|
|
82
82
|
exclude = [
|
|
@@ -140,4 +140,5 @@ known-first-party = ["pytest_sort"]
|
|
|
140
140
|
"PLR2004", # Magic value used in comparison
|
|
141
141
|
"S101", # Use of `assert` detected
|
|
142
142
|
"SLF001", # Private member accessed
|
|
143
|
+
"RUF059", # Unpacked variable is never used
|
|
143
144
|
]
|
|
@@ -5,7 +5,7 @@ from __future__ import annotations
|
|
|
5
5
|
import hashlib
|
|
6
6
|
import random
|
|
7
7
|
from functools import partial
|
|
8
|
-
from typing import TYPE_CHECKING, Any
|
|
8
|
+
from typing import TYPE_CHECKING, Any
|
|
9
9
|
|
|
10
10
|
import pytest
|
|
11
11
|
from _pytest import nodes as pytest_nodes
|
|
@@ -14,12 +14,18 @@ from pytest_sort.config import SortConfig
|
|
|
14
14
|
from pytest_sort.database import get_all_totals, get_stats
|
|
15
15
|
from pytest_sort.diffcov import get_diff_test_scores, get_mut_test_scores
|
|
16
16
|
|
|
17
|
-
md5: Callable = partial(hashlib.md5, usedforsecurity=False) # type: ignore[no-redef]
|
|
18
|
-
|
|
19
|
-
|
|
20
17
|
if TYPE_CHECKING:
|
|
18
|
+
import sys
|
|
19
|
+
|
|
21
20
|
from _pytest.terminal import TerminalReporter
|
|
22
21
|
|
|
22
|
+
if sys.version_info < (3, 14): # nomut
|
|
23
|
+
from typing import Callable # noqa: UP035 # pragma: no cover
|
|
24
|
+
else:
|
|
25
|
+
from collections.abc import Callable
|
|
26
|
+
|
|
27
|
+
md5: Callable = partial(hashlib.md5, usedforsecurity=False) # type: ignore[no-redef]
|
|
28
|
+
|
|
23
29
|
|
|
24
30
|
def create_bucket_id_from_node(node: pytest_nodes.Node | None) -> str:
|
|
25
31
|
"""Extract portion of nodeid needed for bucket key."""
|
|
@@ -138,7 +144,7 @@ def validate_sort_marker(sort_marker: pytest.Mark, node_id: str) -> tuple:
|
|
|
138
144
|
return (mode, bucket)
|
|
139
145
|
|
|
140
146
|
try:
|
|
141
|
-
|
|
147
|
+
mode, bucket_temp = mark_sort_parse(*sort_marker.args, **sort_marker.kwargs)
|
|
142
148
|
except TypeError as e:
|
|
143
149
|
msg = f"Incorrect arguments on marker 'sort'. Target:{node_id}"
|
|
144
150
|
raise TypeError(msg) from e
|
|
@@ -166,7 +172,7 @@ def get_marker_settings(node: pytest_nodes.Node) -> tuple:
|
|
|
166
172
|
node_id = node.nodeid
|
|
167
173
|
|
|
168
174
|
if node.parent:
|
|
169
|
-
|
|
175
|
+
mode, bucket, bucket_id, bucket_sort_key, item_sort_key = get_marker_settings(node.parent)
|
|
170
176
|
|
|
171
177
|
for order in node.iter_markers("order"):
|
|
172
178
|
sort_key = validate_order_marker(order, node_id)
|
|
@@ -177,7 +183,7 @@ def get_marker_settings(node: pytest_nodes.Node) -> tuple:
|
|
|
177
183
|
bucket_id = create_bucket_id_from_node(node)
|
|
178
184
|
|
|
179
185
|
for sort in node.iter_markers("sort"):
|
|
180
|
-
|
|
186
|
+
mode, bucket_temp = validate_sort_marker(sort, node_id)
|
|
181
187
|
|
|
182
188
|
if bucket_temp == "self":
|
|
183
189
|
bucket_id = create_bucket_id_from_node(node)
|
|
@@ -197,7 +203,7 @@ def create_sort_keys(item: pytest.Item, idx: int, count: int) -> None:
|
|
|
197
203
|
|
|
198
204
|
Store in SortConfig.item_sort_keys and SortConfig.bucket_sort_keys
|
|
199
205
|
"""
|
|
200
|
-
|
|
206
|
+
mode, bucket, bucket_id, bucket_sort_key, item_sort_key = get_marker_settings(item)
|
|
201
207
|
|
|
202
208
|
SortConfig.item_sort_keys[item.nodeid] = item_sort_key or create_item_key[mode or SortConfig.mode](item, idx, count)
|
|
203
209
|
|
|
@@ -76,7 +76,7 @@ def get_line_coverage() -> Generator[tuple[Path, str, str, int], Any, None]:
|
|
|
76
76
|
for test in tests:
|
|
77
77
|
match = PARSE_TEST_CONTEXT.search(test)
|
|
78
78
|
if match:
|
|
79
|
-
|
|
79
|
+
nodeid, when = match.group("nodeid", "when")
|
|
80
80
|
yield rpath, nodeid, when, line
|
|
81
81
|
|
|
82
82
|
|
|
@@ -17,7 +17,7 @@ if TYPE_CHECKING:
|
|
|
17
17
|
from _pytest.terminal import TerminalReporter
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
@pytest.hookimpl
|
|
20
|
+
@pytest.hookimpl # nomut: Decorator
|
|
21
21
|
def pytest_addoption(parser: pytest.Parser) -> None:
|
|
22
22
|
"""pytest_sort: Add command line and ini options to pytest."""
|
|
23
23
|
group = parser.getgroup("pytest-sort")
|
|
@@ -65,7 +65,7 @@ def pytest_addoption(parser: pytest.Parser) -> None:
|
|
|
65
65
|
group.addoption("--sort_debug", action="store_true", dest="sort_debug", help=argparse.SUPPRESS)
|
|
66
66
|
|
|
67
67
|
|
|
68
|
-
@pytest.hookimpl
|
|
68
|
+
@pytest.hookimpl # nomut: Decorator
|
|
69
69
|
def pytest_configure(config: pytest.Config) -> None:
|
|
70
70
|
"""pytest_sort: Add markers to pytest."""
|
|
71
71
|
config.addinivalue_line(
|
|
@@ -80,7 +80,7 @@ def pytest_configure(config: pytest.Config) -> None:
|
|
|
80
80
|
SortConfig.from_pytest(config)
|
|
81
81
|
|
|
82
82
|
|
|
83
|
-
@pytest.hookimpl
|
|
83
|
+
@pytest.hookimpl # nomut: Decorator
|
|
84
84
|
def pytest_report_header(config: pytest.Config) -> str: # noqa: ARG001
|
|
85
85
|
"""pytest_sort: Build Header for pytest to display."""
|
|
86
86
|
header = "pytest-sort:"
|
|
@@ -91,7 +91,7 @@ def pytest_report_header(config: pytest.Config) -> str: # noqa: ARG001
|
|
|
91
91
|
return header
|
|
92
92
|
|
|
93
93
|
|
|
94
|
-
@pytest.hookimpl
|
|
94
|
+
@pytest.hookimpl # nomut: Decorator
|
|
95
95
|
def pytest_collection_modifyitems(
|
|
96
96
|
session: pytest.Session, # noqa: ARG001
|
|
97
97
|
config: pytest.Config, # noqa: ARG001
|
|
@@ -104,7 +104,7 @@ def pytest_collection_modifyitems(
|
|
|
104
104
|
sort_items(items)
|
|
105
105
|
|
|
106
106
|
|
|
107
|
-
@pytest.hookimpl(hookwrapper=True) #
|
|
107
|
+
@pytest.hookimpl(hookwrapper=True) # nomut
|
|
108
108
|
def pytest_runtest_makereport(item: pytest.Item, call: pytest.CallInfo) -> Generator:
|
|
109
109
|
"""pytest_sort: Record test runtimes in memory."""
|
|
110
110
|
if SortConfig.record and call.when in ("setup", "call", "teardown"):
|
|
@@ -118,7 +118,7 @@ def pytest_runtest_makereport(item: pytest.Item, call: pytest.CallInfo) -> Gener
|
|
|
118
118
|
yield
|
|
119
119
|
|
|
120
120
|
|
|
121
|
-
@pytest.hookimpl
|
|
121
|
+
@pytest.hookimpl # nomut: Decorator
|
|
122
122
|
def pytest_terminal_summary(
|
|
123
123
|
terminalreporter: TerminalReporter,
|
|
124
124
|
exitstatus: int, # noqa: ARG001
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pytest-sort
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.3
|
|
4
4
|
Summary: Tools for sorting test cases
|
|
5
5
|
Author-email: WiredNerd <pbuschmail-pytestsort@yahoo.com>
|
|
6
6
|
Maintainer-email: WiredNerd <pbuschmail-pytestsort@yahoo.com>
|
|
@@ -34,16 +34,17 @@ Classifier: Programming Language :: Python :: 3
|
|
|
34
34
|
Classifier: License :: OSI Approved :: MIT License
|
|
35
35
|
Classifier: Operating System :: OS Independent
|
|
36
36
|
Classifier: Framework :: Pytest
|
|
37
|
-
Requires-Python: >=3.
|
|
37
|
+
Requires-Python: >=3.10
|
|
38
38
|
Description-Content-Type: text/markdown
|
|
39
39
|
License-File: LICENSE
|
|
40
40
|
Requires-Dist: pytest>=7.4.0
|
|
41
41
|
Requires-Dist: whatthepatch>=1.0.5
|
|
42
42
|
Requires-Dist: coverage>=7.3.1
|
|
43
|
+
Requires-Dist: zipp>=3.19.1
|
|
43
44
|
Dynamic: license-file
|
|
44
45
|
|
|
45
46
|
[](https://github.com/WiredNerd/pytest-sort)
|
|
46
|
-
[](https://pypi.org/project/pytest-sort)
|
|
47
48
|
[](https://pypi.org/project/pytest-sort)
|
|
48
49
|
[](https://pypistats.org/packages/pytest-sort)
|
|
49
50
|
[](https://github.com/WiredNerd/pytest-sort/blob/main/LICENSE)
|
|
@@ -104,7 +104,7 @@ class TestSortConfig:
|
|
|
104
104
|
|
|
105
105
|
def test_from_pytest_mode_invalid(self):
|
|
106
106
|
pytest_config = self.PytestConfig({"sort_mode": "September"}, {})
|
|
107
|
-
with pytest.raises(ValueError, match="^Invalid Value for sort-mode='September'$"):
|
|
107
|
+
with pytest.raises(ValueError, match=r"^Invalid Value for sort-mode='September'$"):
|
|
108
108
|
config.SortConfig.from_pytest(pytest_config)
|
|
109
109
|
|
|
110
110
|
@pytest.mark.parametrize(
|
|
@@ -128,7 +128,7 @@ class TestSortConfig:
|
|
|
128
128
|
|
|
129
129
|
def test_from_pytest_bucket_invalid(self):
|
|
130
130
|
pytest_config = self.PytestConfig({"sort_bucket": "September"}, {})
|
|
131
|
-
with pytest.raises(ValueError, match="^Invalid Value for sort-bucket='September'$"):
|
|
131
|
+
with pytest.raises(ValueError, match=r"^Invalid Value for sort-bucket='September'$"):
|
|
132
132
|
config.SortConfig.from_pytest(pytest_config)
|
|
133
133
|
|
|
134
134
|
@pytest.mark.parametrize(
|
|
@@ -155,12 +155,12 @@ class TestSortConfig:
|
|
|
155
155
|
|
|
156
156
|
def test_from_pytest_bucket_mode_invalid(self):
|
|
157
157
|
pytest_config = self.PytestConfig({"sort_bucket_mode": "September"}, {})
|
|
158
|
-
with pytest.raises(ValueError, match="^Invalid Value for sort-bucket-mode='September'$"):
|
|
158
|
+
with pytest.raises(ValueError, match=r"^Invalid Value for sort-bucket-mode='September'$"):
|
|
159
159
|
config.SortConfig.from_pytest(pytest_config)
|
|
160
160
|
|
|
161
161
|
def test_from_pytest_sort_record_conflict(self):
|
|
162
162
|
pytest_config = self.PytestConfig({"sort_no_record": True, "sort_record": True}, {})
|
|
163
|
-
with pytest.raises(ValueError, match="^Do not use both --sort-record-times and --sort-no-record-times$"):
|
|
163
|
+
with pytest.raises(ValueError, match=r"^Do not use both --sort-record-times and --sort-no-record-times$"):
|
|
164
164
|
config.SortConfig.from_pytest(pytest_config)
|
|
165
165
|
|
|
166
166
|
@pytest.mark.parametrize(
|
|
@@ -202,7 +202,7 @@ class TestSortConfig:
|
|
|
202
202
|
|
|
203
203
|
def test_from_pytest_seed_invalid(self):
|
|
204
204
|
pytest_config = self.PytestConfig({}, {"sort_seed": "ABC"})
|
|
205
|
-
with pytest.raises(ValueError, match="^Invalid seed value 'ABC' must be int$"):
|
|
205
|
+
with pytest.raises(ValueError, match=r"^Invalid seed value 'ABC' must be int$"):
|
|
206
206
|
config.SortConfig.from_pytest(pytest_config)
|
|
207
207
|
|
|
208
208
|
@pytest.mark.parametrize(
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import hashlib
|
|
2
2
|
import importlib
|
|
3
|
+
import sys
|
|
3
4
|
from functools import partial
|
|
4
|
-
from typing import
|
|
5
|
+
from typing import ClassVar
|
|
5
6
|
from unittest import mock
|
|
6
7
|
|
|
7
8
|
import pytest
|
|
@@ -9,6 +10,11 @@ from _pytest import nodes as pytest_nodes
|
|
|
9
10
|
|
|
10
11
|
from pytest_sort import config, core
|
|
11
12
|
|
|
13
|
+
if sys.version_info < (3, 14): # nomut
|
|
14
|
+
from typing import Callable # noqa: UP035 # pragma: no cover
|
|
15
|
+
else:
|
|
16
|
+
from collections.abc import Callable
|
|
17
|
+
|
|
12
18
|
md5: Callable = partial(hashlib.md5, usedforsecurity=False) # type: ignore[no-redef]
|
|
13
19
|
|
|
14
20
|
|
|
@@ -78,7 +84,7 @@ class TestCreateBucketIdForNode:
|
|
|
78
84
|
assert core.create_bucket_id_from_node(node) == bucket_id
|
|
79
85
|
|
|
80
86
|
def test_create_bucket_id_for_package(self, mock_objects):
|
|
81
|
-
|
|
87
|
+
session, package, module, cls, func = mock_objects
|
|
82
88
|
|
|
83
89
|
assert core.create_bucket_id_for_package(session) == "session"
|
|
84
90
|
assert core.create_bucket_id_for_package(package) == "tests/core/"
|
|
@@ -90,7 +96,7 @@ class TestCreateBucketIdForNode:
|
|
|
90
96
|
assert core.create_bucket_id_for_package(module) == ""
|
|
91
97
|
|
|
92
98
|
def test_create_bucket_id_for_module(self, mock_objects):
|
|
93
|
-
|
|
99
|
+
session, package, module, cls, func = mock_objects
|
|
94
100
|
|
|
95
101
|
assert core.create_bucket_id_for_module(session) == "session"
|
|
96
102
|
assert core.create_bucket_id_for_module(package) == "tests/core/"
|
|
@@ -102,7 +108,7 @@ class TestCreateBucketIdForNode:
|
|
|
102
108
|
assert core.create_bucket_id_for_module(cls) == ""
|
|
103
109
|
|
|
104
110
|
def test_create_bucket_id_for_class(self, mock_objects):
|
|
105
|
-
|
|
111
|
+
session, package, module, cls, func = mock_objects
|
|
106
112
|
|
|
107
113
|
assert core.create_bucket_id_for_class(session) == "session"
|
|
108
114
|
assert core.create_bucket_id_for_class(package) == "tests/core/"
|
|
@@ -116,7 +122,7 @@ class TestCreateBucketIdForNode:
|
|
|
116
122
|
|
|
117
123
|
class TestCreateBucketId:
|
|
118
124
|
def test_create_bucket_id(self, mock_objects):
|
|
119
|
-
|
|
125
|
+
session, package, module, cls, func = mock_objects
|
|
120
126
|
|
|
121
127
|
assert core.create_bucket_id["session"](func) == ""
|
|
122
128
|
assert core.create_bucket_id["package"](func) == "tests/core/"
|
|
@@ -127,7 +133,7 @@ class TestCreateBucketId:
|
|
|
127
133
|
assert core.create_bucket_id["grandparent"](func) == "tests/core/test_core.py"
|
|
128
134
|
|
|
129
135
|
def test_create_item_key(self, mock_objects):
|
|
130
|
-
|
|
136
|
+
session, package, module, cls, func = mock_objects
|
|
131
137
|
|
|
132
138
|
assert core.create_item_key["ordered"](func, 5, 20) == 6
|
|
133
139
|
assert core.create_item_key["reverse"](func, 5, 20) == 15
|
|
@@ -138,21 +144,21 @@ class TestCreateBucketId:
|
|
|
138
144
|
assert 0 <= core.create_item_key["random"](func, 5, 20) < 1
|
|
139
145
|
|
|
140
146
|
def test_create_item_key_fastest(self, mock_objects):
|
|
141
|
-
|
|
147
|
+
session, package, module, cls, func = mock_objects
|
|
142
148
|
|
|
143
149
|
assert core.create_item_key["fastest"](func, 5, 20) == 0
|
|
144
150
|
core.SortConfig.item_totals = {func.nodeid: 123}
|
|
145
151
|
assert core.create_item_key["fastest"](func, 5, 20) == 123
|
|
146
152
|
|
|
147
153
|
def test_create_item_key_diffcov(self, mock_objects):
|
|
148
|
-
|
|
154
|
+
session, package, module, cls, func = mock_objects
|
|
149
155
|
|
|
150
156
|
assert core.create_item_key["diffcov"](func, 5, 20) == 0
|
|
151
157
|
core.SortConfig.diff_cov_scores = {func.nodeid: -123}
|
|
152
158
|
assert core.create_item_key["diffcov"](func, 5, 20) == -123
|
|
153
159
|
|
|
154
160
|
def test_create_item_key_mutcov(self, mock_objects):
|
|
155
|
-
|
|
161
|
+
session, package, module, cls, func = mock_objects
|
|
156
162
|
|
|
157
163
|
assert core.create_item_key["mutcov"](func, 5, 20) == 0
|
|
158
164
|
core.SortConfig.mut_cov_scores = {func.nodeid: -123}
|
|
@@ -218,7 +224,9 @@ class TestValidateMarker:
|
|
|
218
224
|
order_marker.args = []
|
|
219
225
|
order_marker.kwargs = {}
|
|
220
226
|
|
|
221
|
-
with pytest.raises(
|
|
227
|
+
with pytest.raises(
|
|
228
|
+
TypeError, match=r"^Incorrect arguments on marker 'order'. Target:testnodeid$"
|
|
229
|
+
) as type_error:
|
|
222
230
|
core.validate_order_marker(order_marker, "testnodeid")
|
|
223
231
|
|
|
224
232
|
assert isinstance(type_error.value.__cause__, TypeError)
|
|
@@ -244,7 +252,7 @@ class TestValidateMarker:
|
|
|
244
252
|
sort_marker.args = []
|
|
245
253
|
sort_marker.kwargs = {}
|
|
246
254
|
|
|
247
|
-
with pytest.raises(TypeError, match="^Incorrect arguments on marker 'sort'. Target:testnodeid$") as type_error:
|
|
255
|
+
with pytest.raises(TypeError, match=r"^Incorrect arguments on marker 'sort'. Target:testnodeid$") as type_error:
|
|
248
256
|
core.validate_sort_marker(sort_marker, "testnodeid")
|
|
249
257
|
|
|
250
258
|
assert isinstance(type_error.value.__cause__, TypeError)
|
|
@@ -255,7 +263,7 @@ class TestValidateMarker:
|
|
|
255
263
|
sort_marker.kwargs = {}
|
|
256
264
|
|
|
257
265
|
with pytest.raises(
|
|
258
|
-
ValueError, match="^Invalid Value for 'mode' on 'sort' marker. Value:invalid Target:testnodeid$"
|
|
266
|
+
ValueError, match=r"^Invalid Value for 'mode' on 'sort' marker. Value:invalid Target:testnodeid$"
|
|
259
267
|
) as type_error:
|
|
260
268
|
core.validate_sort_marker(sort_marker, "testnodeid")
|
|
261
269
|
|
|
@@ -264,7 +272,7 @@ class TestValidateMarker:
|
|
|
264
272
|
|
|
265
273
|
class TestMarkerSettings:
|
|
266
274
|
def test_get_marker_settings_order_function(self, mock_objects):
|
|
267
|
-
|
|
275
|
+
session, package, module, cls, func = mock_objects
|
|
268
276
|
|
|
269
277
|
order_1 = mock.MagicMock()
|
|
270
278
|
order_1.args = [1]
|
|
@@ -282,7 +290,7 @@ class TestMarkerSettings:
|
|
|
282
290
|
)
|
|
283
291
|
|
|
284
292
|
def test_get_marker_settings_order_cls(self, mock_objects):
|
|
285
|
-
|
|
293
|
+
session, package, module, cls, func = mock_objects
|
|
286
294
|
|
|
287
295
|
order_1 = mock.MagicMock()
|
|
288
296
|
order_1.args = [1]
|
|
@@ -305,7 +313,7 @@ class TestMarkerSettings:
|
|
|
305
313
|
)
|
|
306
314
|
|
|
307
315
|
def test_get_marker_settings_order_mod(self, mock_objects):
|
|
308
|
-
|
|
316
|
+
session, package, module, cls, func = mock_objects
|
|
309
317
|
|
|
310
318
|
order_1 = mock.MagicMock()
|
|
311
319
|
order_1.args = [1]
|
|
@@ -328,7 +336,7 @@ class TestMarkerSettings:
|
|
|
328
336
|
)
|
|
329
337
|
|
|
330
338
|
def test_get_marker_settings_sort_self(self, mock_objects):
|
|
331
|
-
|
|
339
|
+
session, package, module, cls, func = mock_objects
|
|
332
340
|
|
|
333
341
|
order_1 = mock.MagicMock()
|
|
334
342
|
order_1.args = [1]
|
|
@@ -356,7 +364,7 @@ class TestMarkerSettings:
|
|
|
356
364
|
)
|
|
357
365
|
|
|
358
366
|
def test_get_marker_settings_sort_bucket(self, mock_objects):
|
|
359
|
-
|
|
367
|
+
session, package, module, cls, func = mock_objects
|
|
360
368
|
|
|
361
369
|
order_1 = mock.MagicMock()
|
|
362
370
|
order_1.args = [1]
|
|
@@ -377,12 +385,12 @@ class TestMarkerSettings:
|
|
|
377
385
|
assert core.get_marker_settings(func) == ("random", "parent", None, None, 1)
|
|
378
386
|
|
|
379
387
|
def test_get_marker_settings_no_markers(self, mock_objects):
|
|
380
|
-
|
|
388
|
+
session, package, module, cls, func = mock_objects
|
|
381
389
|
|
|
382
390
|
assert core.get_marker_settings(func) == (None, None, None, None, None)
|
|
383
391
|
|
|
384
392
|
def test_get_marker_settings_error(self, mock_objects):
|
|
385
|
-
|
|
393
|
+
session, package, module, cls, func = mock_objects
|
|
386
394
|
|
|
387
395
|
sort_random = mock.MagicMock()
|
|
388
396
|
sort_random.args = ["random", "hello"]
|
|
@@ -410,7 +418,7 @@ class TestCreateSortKey:
|
|
|
410
418
|
def test_marker_bucketid_sortkey(self, get_marker_settings, mock_objects):
|
|
411
419
|
get_marker_settings.return_value = (None, None, "test/core", None, 1234)
|
|
412
420
|
config.SortConfig.bucket_mode = "ordered"
|
|
413
|
-
|
|
421
|
+
session, package, module, cls, func = mock_objects
|
|
414
422
|
|
|
415
423
|
core.create_sort_keys(func, 6, 60)
|
|
416
424
|
|
|
@@ -424,7 +432,7 @@ class TestCreateSortKey:
|
|
|
424
432
|
get_marker_settings.return_value = ("reverse", "class", None, None, None)
|
|
425
433
|
config.SortConfig.mode = "ordered"
|
|
426
434
|
config.SortConfig.bucket_mode = "ordered"
|
|
427
|
-
|
|
435
|
+
session, package, module, cls, func = mock_objects
|
|
428
436
|
|
|
429
437
|
core.create_sort_keys(func, 6, 60)
|
|
430
438
|
|
|
@@ -439,7 +447,7 @@ class TestCreateSortKey:
|
|
|
439
447
|
config.SortConfig.mode = "ordered"
|
|
440
448
|
config.SortConfig.bucket_mode = "ordered"
|
|
441
449
|
config.SortConfig.bucket = "module"
|
|
442
|
-
|
|
450
|
+
session, package, module, cls, func = mock_objects
|
|
443
451
|
|
|
444
452
|
core.create_sort_keys(func, 6, 60)
|
|
445
453
|
|
|
@@ -454,7 +462,7 @@ class TestCreateSortKey:
|
|
|
454
462
|
config.SortConfig.mode = "ordered"
|
|
455
463
|
config.SortConfig.bucket = "module"
|
|
456
464
|
config.SortConfig.bucket_mode = "reverse"
|
|
457
|
-
|
|
465
|
+
session, package, module, cls, func = mock_objects
|
|
458
466
|
|
|
459
467
|
core.create_sort_keys(func, 6, 60)
|
|
460
468
|
|
|
@@ -467,7 +475,7 @@ class TestCreateSortKey:
|
|
|
467
475
|
config.SortConfig.mode = "reverse"
|
|
468
476
|
config.SortConfig.bucket = "module"
|
|
469
477
|
config.SortConfig.bucket_mode = "ordered"
|
|
470
|
-
|
|
478
|
+
session, package, module, cls, func = mock_objects
|
|
471
479
|
|
|
472
480
|
core.create_sort_keys(func, 6, 60)
|
|
473
481
|
|
|
@@ -480,7 +488,7 @@ class TestCreateSortKey:
|
|
|
480
488
|
config.SortConfig.mode = "fastest"
|
|
481
489
|
config.SortConfig.bucket = "class"
|
|
482
490
|
config.SortConfig.bucket_mode = "fastest"
|
|
483
|
-
|
|
491
|
+
session, package, module, cls, func = mock_objects
|
|
484
492
|
|
|
485
493
|
config.SortConfig.item_totals = {
|
|
486
494
|
func.nodeid: 1.1,
|
|
@@ -498,7 +506,7 @@ class TestCreateSortKey:
|
|
|
498
506
|
config.SortConfig.mode = "ordered"
|
|
499
507
|
config.SortConfig.bucket = "module"
|
|
500
508
|
config.SortConfig.bucket_mode = "ordered"
|
|
501
|
-
|
|
509
|
+
session, package, module, cls, func = mock_objects
|
|
502
510
|
|
|
503
511
|
core.create_sort_keys(func, 0, 60)
|
|
504
512
|
core.create_sort_keys(func, 1, 60)
|
|
@@ -512,7 +520,7 @@ class TestCreateSortKey:
|
|
|
512
520
|
config.SortConfig.mode = "ordered"
|
|
513
521
|
config.SortConfig.bucket = "module"
|
|
514
522
|
config.SortConfig.bucket_mode = "md5"
|
|
515
|
-
|
|
523
|
+
session, package, module, cls, func = mock_objects
|
|
516
524
|
|
|
517
525
|
md5.return_value.digest.side_effect = [b"DEF", b"ABC", b"GHI"]
|
|
518
526
|
|
|
@@ -523,7 +531,7 @@ class TestCreateSortKey:
|
|
|
523
531
|
assert config.SortConfig.bucket_sort_keys == {module.nodeid: b"ABC"}
|
|
524
532
|
|
|
525
533
|
def test_get_item_sort_key(self, mock_objects):
|
|
526
|
-
|
|
534
|
+
session, package, module, cls, func = mock_objects
|
|
527
535
|
|
|
528
536
|
core.SortConfig.item_sort_keys = {func.nodeid: 1.1}
|
|
529
537
|
core.SortConfig.item_bucket_id = {func.nodeid: cls.nodeid}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|