pytest-split 0.8.2__tar.gz → 0.9.0__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.
@@ -1,4 +1,4 @@
1
- Copyright (c) 2021 Jerry Pussinen
1
+ Copyright (c) 2024 Jerry Pussinen
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
@@ -1,25 +1,24 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pytest-split
3
- Version: 0.8.2
3
+ Version: 0.9.0
4
4
  Summary: Pytest plugin which splits the test suite to equally sized sub suites based on test execution time.
5
5
  Home-page: https://jerry-git.github.io/pytest-split
6
6
  License: MIT
7
7
  Keywords: pytest,plugin,split,tests
8
8
  Author: Jerry Pussinen
9
9
  Author-email: jerry.pussinen@gmail.com
10
- Requires-Python: >=3.7.1,<4.0
10
+ Requires-Python: >=3.8.1,<4.0
11
11
  Classifier: Development Status :: 4 - Beta
12
12
  Classifier: Intended Audience :: Developers
13
13
  Classifier: License :: OSI Approved :: MIT License
14
14
  Classifier: Operating System :: OS Independent
15
15
  Classifier: Programming Language :: Python
16
16
  Classifier: Programming Language :: Python :: 3
17
- Classifier: Programming Language :: Python :: 3.8
18
17
  Classifier: Programming Language :: Python :: 3.9
19
18
  Classifier: Programming Language :: Python :: 3.10
20
19
  Classifier: Programming Language :: Python :: 3.11
21
20
  Classifier: Programming Language :: Python :: 3.12
22
- Classifier: Programming Language :: Python :: 3.7
21
+ Classifier: Programming Language :: Python :: 3.8
23
22
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
24
23
  Classifier: Typing :: Typed
25
24
  Requires-Dist: pytest (>=5,<9)
@@ -125,7 +124,7 @@ The `least_duration` algorithm walks the list of tests and assigns each test to
125
124
  * Clone this repository
126
125
  * Requirements:
127
126
  * [Poetry](https://python-poetry.org/)
128
- * Python 3.7+
127
+ * Python 3.8+
129
128
  * Create a virtual environment and install the dependencies
130
129
 
131
130
  ```sh
@@ -146,9 +145,8 @@ pytest
146
145
 
147
146
  ### Documentation
148
147
 
149
- The documentation is automatically generated from the content of the [docs directory](./docs) and from the docstrings
150
- of the public signatures of the source code. The documentation is updated and published as a [Github project page
151
- ](https://pages.github.com/) automatically as part each release.
148
+ The documentation is automatically generated from the content of the [docs directory](https://github.com/jerry-git/pytest-split/tree/master/docs) and from the docstrings
149
+ of the public signatures of the source code. The documentation is updated and published as a [Github Pages page](https://pages.github.com/) automatically as part each release.
152
150
 
153
151
  ### Releasing
154
152
 
@@ -162,7 +160,7 @@ Find the draft release from the
162
160
 
163
161
  ### Pre-commit
164
162
 
165
- Pre-commit hooks run all the auto-formatters (e.g. `black`), linters (e.g. `mypy`, `ruff`), and other quality
163
+ Pre-commit hooks run all the auto-formatting (`ruff format`), linters (e.g. `ruff` and `mypy`), and other quality
166
164
  checks to make sure the changeset is in good shape before a commit/push happens.
167
165
 
168
166
  You can install the hooks with (runs for each commit):
@@ -96,7 +96,7 @@ The `least_duration` algorithm walks the list of tests and assigns each test to
96
96
  * Clone this repository
97
97
  * Requirements:
98
98
  * [Poetry](https://python-poetry.org/)
99
- * Python 3.7+
99
+ * Python 3.8+
100
100
  * Create a virtual environment and install the dependencies
101
101
 
102
102
  ```sh
@@ -117,9 +117,8 @@ pytest
117
117
 
118
118
  ### Documentation
119
119
 
120
- The documentation is automatically generated from the content of the [docs directory](./docs) and from the docstrings
121
- of the public signatures of the source code. The documentation is updated and published as a [Github project page
122
- ](https://pages.github.com/) automatically as part each release.
120
+ The documentation is automatically generated from the content of the [docs directory](https://github.com/jerry-git/pytest-split/tree/master/docs) and from the docstrings
121
+ of the public signatures of the source code. The documentation is updated and published as a [Github Pages page](https://pages.github.com/) automatically as part each release.
123
122
 
124
123
  ### Releasing
125
124
 
@@ -133,7 +132,7 @@ Find the draft release from the
133
132
 
134
133
  ### Pre-commit
135
134
 
136
- Pre-commit hooks run all the auto-formatters (e.g. `black`), linters (e.g. `mypy`, `ruff`), and other quality
135
+ Pre-commit hooks run all the auto-formatting (`ruff format`), linters (e.g. `ruff` and `mypy`), and other quality
137
136
  checks to make sure the changeset is in good shape before a commit/push happens.
138
137
 
139
138
  You can install the hooks with (runs for each commit):
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "pytest-split"
3
- version = "0.8.2"
3
+ version = "0.9.0"
4
4
  description = "Pytest plugin which splits the test suite to equally sized sub suites based on test execution time."
5
5
  authors = [
6
6
  "Jerry Pussinen <jerry.pussinen@gmail.com>",
@@ -18,27 +18,25 @@ classifiers = [
18
18
  "Operating System :: OS Independent",
19
19
  "Programming Language :: Python",
20
20
  "Programming Language :: Python :: 3",
21
- "Programming Language :: Python :: 3.7",
22
21
  "Programming Language :: Python :: 3.8",
23
22
  "Programming Language :: Python :: 3.9",
24
23
  "Programming Language :: Python :: 3.10",
25
24
  "Programming Language :: Python :: 3.11",
25
+ "Programming Language :: Python :: 3.12",
26
26
  "Topic :: Software Development :: Libraries :: Python Modules",
27
27
  "Typing :: Typed",
28
28
  ]
29
29
 
30
30
  keywords = ['pytest', 'plugin', 'split', 'tests']
31
31
  packages = [{ include = 'pytest_split', from = 'src' }]
32
- include = ['LICENCE']
33
32
 
34
33
 
35
34
  [tool.poetry.dependencies]
36
- python = ">=3.7.1, <4.0"
35
+ python = ">=3.8.1, <4.0"
37
36
  pytest = "^5 | ^6 | ^7 | ^8"
38
37
 
39
38
 
40
39
  [tool.poetry.dev-dependencies]
41
- black = "*"
42
40
  importlib-metadata = "==4.11.*"
43
41
  mkdocstrings = {version = ">=0.18", extras = ["python"]}
44
42
  mkdocs-material = "*"
@@ -49,7 +47,7 @@ pytest = "*"
49
47
  pytest-github-actions-annotate-failures = "*"
50
48
  pytest-cov = "*"
51
49
  python-kacl = "*"
52
- ruff = "*"
50
+ ruff = ">=0.2.0"
53
51
 
54
52
  [build-system]
55
53
  requires = ["poetry-core>=1.0.0"]
@@ -81,22 +79,26 @@ exclude_lines = [
81
79
  ]
82
80
 
83
81
  [tool.mypy]
82
+ # This is the global mypy configuration.
83
+ # Avoid changing this!
84
+ strict = true # See all the enabled flags `mypy --help | grep -A 10 'Strict mode'`
84
85
  disallow_any_unimported = true
85
- disallow_untyped_defs = true
86
- no_implicit_optional = true
87
- strict_equality = true
88
- warn_unused_ignores = true
89
- warn_redundant_casts = true
90
- warn_return_any = true
91
- check_untyped_defs = true
92
- show_error_codes = true
93
86
 
94
87
  [[tool.mypy.overrides]]
95
88
  module = ['tests.*']
96
89
  disallow_untyped_defs = false
97
90
  strict_equality = false
91
+ disallow_untyped_calls = false
92
+
98
93
 
99
94
  [tool.ruff]
95
+ target-version = "py38" # The lowest supported version
96
+
97
+ [tool.ruff.lint]
98
+ # By default, enable all the lint rules.
99
+ # Add to the ignore list below if you don't want some rules.
100
+ # If you need some ignores for certain modules, see tool.ruff.lint.per-file-ignores below.
101
+ # For individual ignore cases, prefer inline `# noqa`s within the code.
100
102
  select = ["ALL"]
101
103
  ignore = [
102
104
  "ANN", # Type hints related, let mypy handle these.
@@ -112,5 +114,20 @@ ignore = [
112
114
  "TRY003", # "Avoid specifying long messages outside the exception class"
113
115
  "FA100", # "Missing `from __future__ import annotations` ..." pytest-split supports a range of Python versions
114
116
  ]
115
- line-length = 88
116
- target-version = "py37"
117
+
118
+ [tool.ruff.lint.per-file-ignores]
119
+ "tests/**" = [
120
+ "S101", # "Use of `assert` detected"
121
+ "ARG", # "Unused function argument". Fixtures are often unused.
122
+ "S105", # "Possible hardcoded password".
123
+ ]
124
+
125
+ [tool.ruff.lint.mccabe]
126
+ max-complexity = 10
127
+
128
+ [tool.ruff.lint.pep8-naming]
129
+ classmethod-decorators = [
130
+ "classmethod",
131
+ "pydantic.validator",
132
+ "pydantic.root_validator",
133
+ ]
@@ -51,12 +51,12 @@ def least_duration(
51
51
  items_with_durations_indexed, key=lambda tup: tup[1], reverse=True
52
52
  )
53
53
 
54
- selected: "List[List[Tuple[nodes.Item, int]]]" = [[] for _ in range(splits)]
55
- deselected: "List[List[nodes.Item]]" = [[] for _ in range(splits)]
56
- duration: "List[float]" = [0 for _ in range(splits)]
54
+ selected: List[List[Tuple[nodes.Item, int]]] = [[] for _ in range(splits)]
55
+ deselected: List[List[nodes.Item]] = [[] for _ in range(splits)]
56
+ duration: List[float] = [0 for _ in range(splits)]
57
57
 
58
58
  # create a heap of the form (summed_durations, group_index)
59
- heap: "List[Tuple[float, int]]" = [(0, i) for i in range(splits)]
59
+ heap: List[Tuple[float, int]] = [(0, i) for i in range(splits)]
60
60
  heapq.heapify(heap)
61
61
  for item, item_duration, original_index in sorted_items_with_durations:
62
62
  # get group with smallest sum
@@ -102,9 +102,9 @@ def duration_based_chunks(
102
102
  items_with_durations = _get_items_with_durations(items, durations)
103
103
  time_per_group = sum(map(itemgetter(1), items_with_durations)) / splits
104
104
 
105
- selected: "List[List[nodes.Item]]" = [[] for i in range(splits)]
106
- deselected: "List[List[nodes.Item]]" = [[] for i in range(splits)]
107
- duration: "List[float]" = [0 for i in range(splits)]
105
+ selected: List[List[nodes.Item]] = [[] for i in range(splits)]
106
+ deselected: List[List[nodes.Item]] = [[] for i in range(splits)]
107
+ duration: List[float] = [0 for i in range(splits)]
108
108
 
109
109
  group_idx = 0
110
110
  for item, item_duration in items_with_durations:
@@ -6,7 +6,7 @@ if TYPE_CHECKING:
6
6
  from pytest_split.algorithms import TestGroup
7
7
 
8
8
 
9
- def ensure_ipynb_compatibility(group: "TestGroup", items: list) -> None:
9
+ def ensure_ipynb_compatibility(group: "TestGroup", items: list) -> None: # type: ignore[type-arg]
10
10
  """
11
11
  Ensures that group doesn't contain partial IPy notebook cells.
12
12
 
@@ -15,7 +15,7 @@ if TYPE_CHECKING:
15
15
  from _pytest import nodes
16
16
  from _pytest.config import Config
17
17
  from _pytest.config.argparsing import Parser
18
- from _pytest.main import ExitCode
18
+ from _pytest.main import ExitCode # type: ignore[attr-defined]
19
19
 
20
20
 
21
21
  # Ugly hack for freezegun compatibility: https://github.com/spulec/freezegun/issues/286
@@ -193,9 +193,9 @@ class PytestSplitCachePlugin(Base):
193
193
  https://github.com/pytest-dev/pytest/blob/main/src/_pytest/main.py#L308
194
194
  """
195
195
  terminal_reporter = self.config.pluginmanager.get_plugin("terminalreporter")
196
- test_durations: "Dict[str, float]" = {}
196
+ test_durations: Dict[str, float] = {}
197
197
 
198
- for test_reports in terminal_reporter.stats.values():
198
+ for test_reports in terminal_reporter.stats.values(): # type: ignore[union-attr]
199
199
  for test_report in test_reports:
200
200
  if isinstance(test_report, TestReport):
201
201
  # These ifs be removed after this is solved: # https://github.com/spulec/freezegun/issues/286
@@ -224,8 +224,6 @@ class PytestSplitCachePlugin(Base):
224
224
  json.dump(self.cached_durations, f, sort_keys=True, indent=4)
225
225
 
226
226
  message = self.writer.markup(
227
- "\n\n[pytest-split] Stored test durations in {}".format(
228
- self.config.option.durations_path
229
- )
227
+ f"\n\n[pytest-split] Stored test durations in {self.config.option.durations_path}"
230
228
  )
231
229
  self.writer.line(message)