From 78aa312c79d97d8f6b0b7b2f166073bd2c798c7b Mon Sep 17 00:00:00 2001 From: Remi Lehe Date: Tue, 22 Oct 2024 15:24:25 -0700 Subject: [PATCH] Remove obsolete `python setup.py test` command --- .github/workflows/unix.yml | 5 +++-- .github/workflows/windows.yml | 5 +++-- CONTRIBUTING.md | 2 +- setup.py | 12 ------------ tests/test_tutorials.py | 2 +- 5 files changed, 8 insertions(+), 18 deletions(-) diff --git a/.github/workflows/unix.yml b/.github/workflows/unix.yml index 1a3f55fa..a5587016 100644 --- a/.github/workflows/unix.yml +++ b/.github/workflows/unix.yml @@ -28,11 +28,12 @@ jobs: conda install --yes cython numpy scipy h5py openpmd-api matplotlib jupyter pytest pyflakes python=${{ matrix.python-version }} python-wget else conda install --yes cython numpy scipy h5py matplotlib jupyter pytest pyflakes python=${{ matrix.python-version }} python-wget - fi + fi; + python setup.py install - shell: bash -eo pipefail -l {0} name: pyflakes run: python -m pyflakes openpmd_viewer - shell: bash -eo pipefail -l {0} name: Test - run: python setup.py test + run: python -m pytest tests diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index a5561598..d55e1613 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -15,6 +15,7 @@ jobs: - uses: actions/checkout@v3 - name: Install dependencies run: | - python -m pip install cython numpy scipy h5py openpmd-api matplotlib jupyter pytest pyflakes wget + python -m pip install cython numpy scipy h5py openpmd-api matplotlib jupyter pytest pyflakes wget; + python setup.py install - name: Test - run: python setup.py test + run: python -m pytest tests diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9843e96a..90d81537 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -56,7 +56,7 @@ git pull git@github.com:openPMD/openPMD-viewer.git dev ``` python -m pip wheel . python -m pip install *whl matplotlib jupyter - python setup.py test + python -m pytest tests ``` (Be patient: the `test_tutorials.py` can take approx. 20 seconds if you already downloaded the example openPMD files that are required diff --git a/setup.py b/setup.py index 84a196cd..7687b85e 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,4 @@ -import sys from setuptools import setup, find_packages -from setuptools.command.test import test as TestCommand # Get the long description with open('./README.md') as f: @@ -14,14 +12,6 @@ with open('./openpmd_viewer/__version__.py') as f: exec( f.read() ) -# Define a custom class to run the py.test with `python setup.py test` -class PyTest(TestCommand): - - def run_tests(self): - import pytest - errcode = pytest.main([]) - sys.exit(errcode) - # Main setup command setup(name='openPMD-viewer', version=__version__, @@ -35,7 +25,6 @@ def run_tests(self): packages=find_packages('.'), package_data={'openpmd_viewer': ['notebook_starter/*.ipynb']}, scripts=['openpmd_viewer/notebook_starter/openPMD_notebook'], - tests_require=['pytest', 'jupyter'], install_requires=install_requires, extras_require = { 'all': ["ipympl", "ipywidgets", "matplotlib", "numba", "openpmd-api", "wget"], @@ -45,7 +34,6 @@ def run_tests(self): 'numba': ["numba"], 'openpmd-api': ["openpmd-api"] }, - cmdclass={'test': PyTest}, platforms='any', python_requires='>=3.8', classifiers=[ diff --git a/tests/test_tutorials.py b/tests/test_tutorials.py index 31ccf0b0..eb9c8018 100644 --- a/tests/test_tutorials.py +++ b/tests/test_tutorials.py @@ -8,7 +8,7 @@ by any of the following commands $ python tests/test_tutorials.py $ py.test -$ python setup.py test +$ python -m pytest tests Copyright 2015-2016, openPMD-viewer contributors Authors: Remi Lehe, Axel Huebl