diff --git a/noxfile.py b/noxfile.py index de35bd50f5..f93c88b954 100644 --- a/noxfile.py +++ b/noxfile.py @@ -68,9 +68,7 @@ def run_coverage(session): session.install("-e", ".[all,dev]", silent=False) else: session.install("-e", ".[all,dev,jax]", silent=False) - session.run("coverage", "run", "run-tests.py", "--nosub") - session.run("coverage", "combine") - session.run("coverage", "xml") + session.run("pytest", "--cov=pybamm", "--cov-report=xml", "tests/unit") @nox.session(name="integration") @@ -90,7 +88,7 @@ def run_integration(session): @nox.session(name="doctests") def run_doctests(session): """Run the doctests and generate the output(s) in the docs/build/ directory.""" - session.install("-e", ".[all,docs]", silent=False) + session.install("-e", ".[all,dev,docs]", silent=False) session.run("python", "run-tests.py", "--doctest") @@ -125,7 +123,7 @@ def run_scripts(session): # https://bitbucket.org/pybtex-devs/pybtex/issues/169/replace-pkg_resources-with # is fixed session.install("setuptools", silent=False) - session.install("-e", ".[all]", silent=False) + session.install("-e", ".[all,dev]", silent=False) session.run("python", "run-tests.py", "--scripts") diff --git a/pybamm/expression_tree/operations/latexify.py b/pybamm/expression_tree/operations/latexify.py index e2817ed2d5..435d464e49 100644 --- a/pybamm/expression_tree/operations/latexify.py +++ b/pybamm/expression_tree/operations/latexify.py @@ -79,7 +79,7 @@ def _get_geometry_displays(self, var): for _, rng in self.model.default_geometry[var.domain[-1]].items(): rng_max = get_rng_min_max_name(rng, "max") - geo_latex = f"\quad {rng_min} < {name} < {rng_max}" + geo_latex = rf"\quad {rng_min} < {name} < {rng_max}" geo.append(geo_latex) return geo diff --git a/pybamm/expression_tree/printing/sympy_overrides.py b/pybamm/expression_tree/printing/sympy_overrides.py index 58ac356399..14a49a7a71 100644 --- a/pybamm/expression_tree/printing/sympy_overrides.py +++ b/pybamm/expression_tree/printing/sympy_overrides.py @@ -14,7 +14,7 @@ def _print_Derivative(self, expr): eqn = super()._print_Derivative(expr) if getattr(expr, "force_partial", False) and "partial" not in eqn: var1, var2 = re.findall(r"^\\frac{(\w+)}{(\w+) .+", eqn)[0] - eqn = eqn.replace(var1, "\partial").replace(var2, "\partial") + eqn = eqn.replace(var1, r"\partial").replace(var2, r"\partial") return eqn diff --git a/pybamm/plotting/quick_plot.py b/pybamm/plotting/quick_plot.py index c43498c41b..c2ffa38127 100644 --- a/pybamm/plotting/quick_plot.py +++ b/pybamm/plotting/quick_plot.py @@ -160,7 +160,7 @@ def __init__( self.spatial_unit = "mm" elif spatial_unit == "um": # micrometers self.spatial_factor = 1e6 - self.spatial_unit = "$\mu$m" + self.spatial_unit = r"$\mu$m" else: raise ValueError(f"spatial unit '{spatial_unit}' not recognized") diff --git a/pyproject.toml b/pyproject.toml index a992309c73..30ed16a17a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -106,7 +106,7 @@ dev = [ # For running testing sessions "nox", # For coverage - "coverage[toml]", + "pytest-cov", # For test parameterization "parameterized>=0.9", # For testing Jupyter notebooks @@ -244,6 +244,10 @@ filterwarnings = [ # ignore internal nbmake warnings 'ignore:unclosed \