diff options
| -rw-r--r-- | Makefile | 6 | ||||
| -rw-r--r-- | pyproject.toml | 8 | ||||
| -rw-r--r-- | test/ec/test_configuration.py | 5 | ||||
| -rw-r--r-- | test/ec/utils.py | 6 | ||||
| -rw-r--r-- | test/sca/test_align.py | 7 | ||||
| -rw-r--r-- | test/sca/utils.py | 10 | ||||
| -rw-r--r-- | unittest.cfg | 3 |
7 files changed, 17 insertions, 28 deletions
@@ -12,13 +12,13 @@ TESTS = ${EC_TESTS} ${SCA_TESTS} PERF_SCRIPTS = test.ec.perf_mod test.ec.perf_formula test.ec.perf_mult test.sca.perf_combine test: - nose2 -E "not slow and not disabled" -C -v ${TESTS} + pytest -m "not slow" --cov=pyecsca test-plots: - env PYECSCA_TEST_PLOTS=1 nose2 -E "not slow and not disabled" -C -v ${TESTS} + env PYECSCA_TEST_PLOTS=1 pytest -m "not slow" test-all: - nose2 -C -v ${TESTS} + pytest --cov=pyecsca typecheck: mypy --namespace-packages -p pyecsca --ignore-missing-imports --show-error-codes --check-untyped-defs diff --git a/pyproject.toml b/pyproject.toml index 8660496..bfffb07 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -57,7 +57,7 @@ "leia" = ["smartleia"] "gmp" = ["gmpy2"] "dev" = ["mypy", "flake8", "interrogate", "pyinstrument", "black", "types-setuptools"] -"test" = ["nose2", "parameterized", "coverage"] +"test" = ["pytest", "coverage", "pytest-cov"] "doc" = ["sphinx", "sphinx-autodoc-typehints", "nbsphinx", "sphinx-paramlinks", "sphinx_design"] [tool.setuptools.packages.find] @@ -66,3 +66,9 @@ namespaces = true [tool.setuptools.package-data] pyecsca = ["ec/efd/*/*", "ec/efd/*/*/*", "ec/efd/*/*/*/*", "ec/std/*", "ec/std/*/*"] + +[tool.pytest.ini_options] +testpaths = ["test"] +markers = [ + "slow: marks tests as slow (deselect with '-m \"not slow\"')", +] diff --git a/test/ec/test_configuration.py b/test/ec/test_configuration.py index d2ab3f5..a90f3ce 100644 --- a/test/ec/test_configuration.py +++ b/test/ec/test_configuration.py @@ -1,5 +1,7 @@ from unittest import TestCase +import pytest + from pyecsca.ec.configuration import ( all_configurations, HashType, @@ -11,7 +13,6 @@ from pyecsca.ec.configuration import ( ) from pyecsca.ec.model import ShortWeierstrassModel from pyecsca.ec.mult import LTRMultiplier -from .utils import slow class ConfigurationTests(TestCase): @@ -25,7 +26,7 @@ class ConfigurationTests(TestCase): "inv": Inversion.GCD, } - @slow + @pytest.mark.slow def test_all(self): j = 0 for _ in all_configurations(model=ShortWeierstrassModel()): diff --git a/test/ec/utils.py b/test/ec/utils.py index 67a9cc0..0d0a875 100644 --- a/test/ec/utils.py +++ b/test/ec/utils.py @@ -1,12 +1,6 @@ from itertools import product from functools import reduce - -def slow(func): - func.slow = 1 - return func - - def cartesian(*items): for cart in product(*items): yield reduce(lambda x, y: x + y, cart) diff --git a/test/sca/test_align.py b/test/sca/test_align.py index aca0f2f..5820171 100644 --- a/test/sca/test_align.py +++ b/test/sca/test_align.py @@ -1,4 +1,5 @@ import numpy as np +import pytest from importlib.resources import files, as_file from pyecsca.sca import ( align_correlation, @@ -10,7 +11,7 @@ from pyecsca.sca import ( InspectorTraceSet, ) import test.data.sca -from .utils import Plottable, slow +from .utils import Plottable class AlignTests(Plottable): @@ -43,7 +44,7 @@ class AlignTests(Plottable): self.assertEqual(offsets[0], 0) self.assertEqual(offsets[1], 3) - @slow + @pytest.mark.slow def test_large_align(self): with as_file(files(test.data.sca).joinpath("example.trs")) as path: example = InspectorTraceSet.read(path) @@ -52,7 +53,7 @@ class AlignTests(Plottable): ) self.assertIsNotNone(result) - @slow + @pytest.mark.slow def test_large_dtw_align(self): with as_file(files(test.data.sca).joinpath("example.trs")) as path: example = InspectorTraceSet.read(path) diff --git a/test/sca/utils.py b/test/sca/utils.py index b00015b..ad77d21 100644 --- a/test/sca/utils.py +++ b/test/sca/utils.py @@ -10,16 +10,6 @@ from pyecsca.sca import Trace force_plot = True -def slow(func): - func.slow = 1 - return func - - -def disabled(func): - func.disabled = 1 - return func - - cases: Dict[str, int] = {} diff --git a/unittest.cfg b/unittest.cfg deleted file mode 100644 index 7c90619..0000000 --- a/unittest.cfg +++ /dev/null @@ -1,3 +0,0 @@ -[unittest] -plugins = nose2.plugins.attrib - nose2.plugins.doctests |
