Skip to content

Commit 051a6c0

Browse files
update to pytest 9.0, remove pytest-subtests (#5271)
* update to pytest 9.0, remove pytest-subtests * update docs
1 parent 24db71a commit 051a6c0

File tree

2 files changed

+43
-72
lines changed

2 files changed

+43
-72
lines changed

docs/source/user_guide/installation/index.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,8 @@ Dependency
158158
`pre-commit <https://pre-commit.com/index.html>`__ \- dev For managing and maintaining multi-language pre-commit hooks.
159159
`ruff <https://beta.ruff.rs/docs/>`__ \- dev For code formatting.
160160
`nox <https://nox.thea.codes/en/stable/>`__ \- dev For running testing sessions in multiple environments.
161-
`pytest-subtests <https://github.com/pytest-dev/pytest-subtests/>`__ \- dev For subtests pytest fixture.
162161
`pytest-cov <https://pytest-cov.readthedocs.io/en/stable/>`__ \- dev For calculating test coverage.
163-
`pytest <https://docs.pytest.org/en/stable/>`__ 6.0.0 dev For running the test suites.
162+
`pytest <https://docs.pytest.org/en/stable/>`__ 9.0.0 dev For running the test suites (includes subtests support).
164163
`pytest-doctestplus <https://github.com/scientific-python/pytest-doctestplus>`__ \- dev For running doctests.
165164
`pytest-xdist <https://pytest-xdist.readthedocs.io/en/latest/>`__ \- dev For running tests in parallel across distributed workers.
166165
`pytest-mock <https://pytest-mock.readthedocs.io/en/latest/index.html>`__ \- dev Provides a mocker fixture.

pyproject.toml

Lines changed: 42 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
11
[build-system]
2-
requires = [
3-
"hatchling>=1.13.0",
4-
"hatch-vcs>=0.3.0",
5-
]
2+
requires = ["hatchling>=1.13.0", "hatch-vcs>=0.3.0"]
63
build-backend = "hatchling.build"
74

85
[project]
96
name = "pybamm"
107
dynamic = ["version"]
118
license = { file = "LICENSE.txt" }
129
description = "Python Battery Mathematical Modelling"
13-
authors = [{name = "The PyBaMM Team", email = "[email protected]"}]
14-
maintainers = [{name = "The PyBaMM Team", email = "[email protected]"}]
10+
authors = [{ name = "The PyBaMM Team", email = "[email protected]" }]
11+
maintainers = [{ name = "The PyBaMM Team", email = "[email protected]" }]
1512
requires-python = ">=3.10, <3.13"
16-
readme = {file = "README.md", content-type = "text/markdown"}
13+
readme = { file = "README.md", content-type = "text/markdown" }
1714
classifiers = [
1815
"Development Status :: 5 - Production/Stable",
1916
"Intended Audience :: Developers",
@@ -70,26 +67,18 @@ docs = [
7067
"sphinx-docsearch",
7168
]
7269
# For example notebooks
73-
examples = [
74-
"jupyter",
75-
]
70+
examples = ["jupyter"]
7671
plot = [
7772
# Note: matplotlib is loaded for debug plots, but to ensure PyBaMM runs
7873
# on systems without an attached display, it should never be imported
7974
# outside of plot() methods.
8075
"matplotlib>=3.6.0",
8176
]
82-
cite = [
83-
"pybtex>=0.25.0",
84-
]
77+
cite = ["pybtex>=0.25.0"]
8578
# Battery Parameter eXchange format
86-
bpx = [
87-
"bpx>=0.5.0,<0.6.0",
88-
]
79+
bpx = ["bpx>=0.5.0,<0.6.0"]
8980
# Low-overhead progress bars
90-
tqdm = [
91-
"tqdm",
92-
]
81+
tqdm = ["tqdm"]
9382
dev = [
9483
# For working with pre-commit hooks
9584
"pre-commit",
@@ -102,20 +91,17 @@ dev = [
10291
# For doctest
10392
"pytest-doctestplus",
10493
# pytest and its plugins
105-
"pytest",
94+
"pytest>=9.0",
10695
"pytest-xdist",
10796
"pytest-mock",
108-
"pytest-subtests",
10997
# For testing Jupyter notebooks
11098
"nbmake",
11199
# To access the metadata for python packages
112100
"importlib-metadata; python_version < '3.10'",
113101
# For property based testing
114102
"hypothesis",
115103
]
116-
jax = [
117-
"jax>=0.4.36,<0.7.0",
118-
]
104+
jax = ["jax>=0.4.36,<0.7.0"]
119105
# Contains all optional dependencies, except for jax, and dev dependencies
120106
all = [
121107
"scikit-fem>=8.1.0",
@@ -155,10 +141,7 @@ Yang2017 = "pybamm.models.full_battery_models.lithium_ion.Yang2017:Yang2017"
155141
[tool.hatch]
156142
version.source = "vcs"
157143
version.fallback-version = "0.0.0"
158-
build.targets.sdist.include = [
159-
"src/pybamm",
160-
"CITATION.cff",
161-
]
144+
build.targets.sdist.include = ["src/pybamm", "CITATION.cff"]
162145
build.hooks.vcs.version-file = "src/pybamm/_version.py"
163146

164147
[tool.repo-review]
@@ -178,8 +161,8 @@ extend-exclude = ["__init__.py"]
178161

179162
[tool.ruff.lint]
180163
extend-select = [
181-
"B", # flake8-bugbear
182-
"I", # isort
164+
"B", # flake8-bugbear
165+
"I", # isort
183166
# "ARG", # flake8-unused-arguments
184167
# "C4", # flake8-comprehensions
185168
# "ICN", # flake8-import-conventions
@@ -190,31 +173,31 @@ extend-select = [
190173
# "PT", # flake8-pytest-style
191174
# "PTH", # flake8-use-pathlib
192175
# "RET", # flake8-return
193-
"RUF", # Ruff-specific
176+
"RUF", # Ruff-specific
194177
# "SIM", # flake8-simplify
195178
# "T20", # flake8-print
196-
"UP", # pyupgrade
197-
"YTT", # flake8-2020
198-
"TID252", # relative-imports
199-
"S101", # to identify use of assert statement
200-
"PT027", # remove unittest style assertion
201-
"PT009", # Use pytest.raises instead of unittest-style
179+
"UP", # pyupgrade
180+
"YTT", # flake8-2020
181+
"TID252", # relative-imports
182+
"S101", # to identify use of assert statement
183+
"PT027", # remove unittest style assertion
184+
"PT009", # Use pytest.raises instead of unittest-style
202185
]
203186
ignore = [
204-
"E741", # Ambiguous variable name
205-
"RUF012", # Mutable class attributes should be annotated with `typing.ClassVar`
206-
"SIM108", # Use ternary operator
207-
"ARG001", # Unused function argument:
208-
"ARG002", # Unused method arguments
209-
"PLR2004", # Magic value used in comparison
210-
"PLR0915", # Too many statements
211-
"PLR0913", # Too many arguments
212-
"PLR0912", # Too many branches
213-
"RET504", # Unnecessary assignment
214-
"RET505", # Unnecessary `else`
215-
"RET506", # Unnecessary `elif`
216-
"B018", # Found useless expression
217-
"RUF002", # Docstring contains ambiguous
187+
"E741", # Ambiguous variable name
188+
"RUF012", # Mutable class attributes should be annotated with `typing.ClassVar`
189+
"SIM108", # Use ternary operator
190+
"ARG001", # Unused function argument:
191+
"ARG002", # Unused method arguments
192+
"PLR2004", # Magic value used in comparison
193+
"PLR0915", # Too many statements
194+
"PLR0913", # Too many arguments
195+
"PLR0912", # Too many branches
196+
"RET504", # Unnecessary assignment
197+
"RET505", # Unnecessary `else`
198+
"RET506", # Unnecessary `elif`
199+
"B018", # Found useless expression
200+
"RUF002", # Docstring contains ambiguous
218201
]
219202

220203
[tool.ruff.lint.per-file-ignores]
@@ -225,21 +208,10 @@ ignore = [
225208
"docs/source/examples/notebooks/models/lithium-plating.ipynb" = ["F821"]
226209

227210
[tool.pytest.ini_options]
228-
minversion = "8"
229-
required_plugins = [
230-
"pytest-xdist",
231-
"pytest-mock",
232-
"pytest-subtests",
233-
]
234-
addopts = [
235-
"-nauto",
236-
"-vra",
237-
"--strict-config",
238-
"--strict-markers",
239-
]
240-
testpaths = [
241-
"tests",
242-
]
211+
minversion = "9.0"
212+
required_plugins = ["pytest-xdist", "pytest-mock"]
213+
addopts = ["-nauto", "-vra", "--strict-config", "--strict-markers"]
214+
testpaths = ["tests"]
243215
console_output_style = "progress"
244216
xfail_strict = true
245217
filterwarnings = [
@@ -254,7 +226,7 @@ filterwarnings = [
254226
]
255227

256228
# Logging configuration
257-
log_cli = "true"
229+
log_cli = true
258230
log_cli_level = "INFO"
259231
log_format = "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
260232
log_date_format = "%Y-%m-%d %H:%M:%S"
@@ -273,7 +245,7 @@ disable_error_code = ["call-overload", "operator"]
273245

274246
[[tool.mypy.overrides]]
275247
module = [
276-
"pybamm.models.base_model.*",
277-
"pybamm.models.full_battery_models.base_battery_model.*"
278-
]
248+
"pybamm.models.base_model.*",
249+
"pybamm.models.full_battery_models.base_battery_model.*",
250+
]
279251
disable_error_code = "attr-defined"

0 commit comments

Comments
 (0)