diff --git a/.github/workflows/buildtest.yml b/.github/workflows/buildtest.yml index 7a9c013ec..b3c8a4ef2 100644 --- a/.github/workflows/buildtest.yml +++ b/.github/workflows/buildtest.yml @@ -39,7 +39,7 @@ jobs: - name: Build optional stormpy libraries run: docker exec ci bash -c "cd /opt/stormpy; pip3 install -e '.${{ matrix.configuration.optionalLibs }}'" - name: Run tests - run: docker exec ci bash -c "cd /opt/stormpy; python setup.py test ${{ matrix.configuration.testOpt }}" + run: docker exec ci bash -c "cd /opt/stormpy; pip install -e '.[test]'; pytest ${{ matrix.configuration.testOpt }}" stableTest: @@ -80,7 +80,7 @@ jobs: fi - name: Run tests if: steps.build_stormpy.outputs.run_tests == 'true' - run: docker exec ci bash -c "cd /opt/stormpy; python setup.py test" + run: docker exec ci bash -c "cd /opt/stormpy; pip install -e '.[test]'; pytest" deploy: @@ -99,7 +99,7 @@ jobs: - name: Run Docker run: docker run -d -it --name ci movesrwth/stormpy:${{ matrix.buildType.dockerTag }} - name: Run tests - run: docker exec ci bash -c "cd /opt/stormpy; python setup.py test" + run: docker exec ci bash -c "cd /opt/stormpy; pip install -e '.[test]'; pytest" - name: Login into docker # Only login if using master on original repo (and not for pull requests or forks) diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 000000000..70bdcf385 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,27 @@ +[tool.black] +line-length = 160 +target-version = [ + "py37", + "py38", + "py39", + "py310", + "py311", +] + +[tool.pytest.ini_options] +minversion = "6.0" +addopts = "--doctest-glob='*.rst' --nbval" +testpaths = [ + "tests", + "examples", + "doc", +] +python_files = [ + "test*.py", + "examples/*.py", +] +python_functions = [ + "*_test", + "test_*", + "example_*", +] diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 98f90431b..000000000 --- a/setup.cfg +++ /dev/null @@ -1,8 +0,0 @@ -[aliases] -test=pytest - -[tool:pytest] -addopts = --doctest-glob='*.rst' --nbval -testpaths = tests/ examples/ doc/ -python_files = test*.py examples/*.py -python_functions = *_test test_* example_* diff --git a/setup.py b/setup.py index f341a9921..b20942aa8 100755 --- a/setup.py +++ b/setup.py @@ -228,13 +228,12 @@ def finalize_options(self): zip_safe=False, install_requires=['pycarl>=2.2.0'], setup_requires=['pycarl>=2.2.0', # required to check pybind version used for pycarl - 'pytest-runner', 'packaging' ], - tests_require=['pytest', 'nbval', 'numpy'], extras_require={ "numpy": ["numpy"], "plot": ["matplotlib","numpy","scipy"], + "test": ["pytest", "nbval", "numpy"], "doc": ["Sphinx", "sphinx-bootstrap-theme", "nbsphinx", "ipython", "ipykernel"], # also requires pandoc to be installed }, python_requires='>=3.7', # required by packaging