Unit Test Compatibility #37
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Unit Test Compatibility | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
schedule: | |
- cron: '0 0 * * *' # daily | |
workflow_dispatch: | |
pull_request_target: | |
types: [opened, synchronize, reopened] | |
jobs: | |
test: | |
runs-on: ubuntu-latest # TODO: make this `["ubuntu-latest", "windows-latest", "macos-latest"]`? | |
strategy: | |
matrix: | |
python-version: ["3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install core PyHC packages # Install all dependencies listed in pyproject.toml | |
run: | | |
python -m pip install --upgrade pip | |
pip install . | |
- name: Clone and test hapiclient | |
run: | | |
git clone https://github.com/hapi-server/client-python.git | |
cd client-python | |
pip install hapiplot deepdiff | |
pytest | |
# Kamodo package has no unit tests | |
# - name: Clone and test kamodo | |
# run: | | |
# git clone https://github.com/nasa/Kamodo.git | |
# cd Kamodo | |
# pip install -r requirements.txt | |
# # pip install . | |
# pytest | |
- name: Clone and test plasmapy | |
if: matrix.python-version != '3.9' # Exclude PlasmaPy for Python 3.9 | |
run: | | |
git clone https://github.com/PlasmaPy/PlasmaPy.git | |
cd PlasmaPy | |
pip install hypothesis | |
# Ignoring 6 tests that are throwing errors & 18 failures | |
# pytest --continue-on-collection-errors -k "not test_detector_stacks and not test_synthetic_radiography and not test_atomic and not test_particle_tracker and not test_save_routines and not test_downloader and not test_Particle_class[neutron-kwargs0-expected_dict0] and not test_Particle_class[p+-kwargs1-expected_dict1] and not test_Particle_class[H-kwargs2-expected_dict2] and not test_Particle_class[e--kwargs5-expected_dict5] and not test_custom_particle_str[kwargs1-I2] and not test_isotopes_have_equivalent_ionization_energy and not test_different_ions_have_different_ionization_energy and not test_zero_charge_ionization_energy and not test_deuterium_ionization_energy and not test_particle_ionization_energy[H-expected_ionization_energy0] and not test_particle_ionization_energy[He-expected_ionization_energy1] and not test_particle_ionization_energy[Li-expected_ionization_energy2] and not test_undefined_ionization_energy and not test_undefined_electron_binding_energy and not test_warning_on_use_of_binding_energy and not test_deuterium_electron_binding_energy and not test_other_isotopes_electron_binding_energy and not test_isotope_ion_electron_binding_energy" | |
pytest --continue-on-collection-errors \ | |
-k "not test_detector_stacks and not test_synthetic_radiography and not test_atomic and not test_particle_tracker and not test_save_routines and not test_downloader and not test_Particle_class[neutron-kwargs0-expected_dict0] and not test_Particle_class[p+-kwargs1-expected_dict1] and not test_Particle_class[H-kwargs2-expected_dict2] and not test_Particle_class[e--kwargs5-expected_dict5] and not test_custom_particle_str[kwargs1-I2] and not test_isotopes_have_equivalent_ionization_energy and not test_different_ions_have_different_ionization_energy and not test_zero_charge_ionization_energy and not test_deuterium_ionization_energy and not test_particle_ionization_energy[H-expected_ionization_energy0] and not test_particle_ionization_energy[He-expected_ionization_energy1] and not test_particle_ionization_energy[Li-expected_ionization_energy2] and not test_undefined_ionization_energy and not test_undefined_electron_binding_energy and not test_warning_on_use_of_binding_energy and not test_deuterium_electron_binding_energy and not test_other_isotopes_electron_binding_energy and not test_isotope_ion_electron_binding_energy and not test_angular_freq_to_hz_preserves_signature and not test_validate_quantities_postponed_annotations" \ | |
--ignore=tests/diagnostics/charged_particle_radiography/test_detector_stacks.py \ | |
--ignore=tests/diagnostics/charged_particle_radiography/test_synthetic_radiography.py \ | |
--ignore=tests/particles/test_atomic.py \ | |
--ignore=tests/simulation/test_particle_tracker.py \ | |
--ignore=tests/simulation/test_save_routines.py \ | |
--ignore=tests/utils/data/test_downloader.py | |
# pysat always fails with "error in Sphinx setup command: use_2to3 is invalid." | |
# - name: Clone and test pysat | |
# continue-on-error: true | |
# run: | | |
# git clone https://github.com/pysat/pysat.git | |
# cd pysat | |
# pip install -r requirements.txt | |
# pip install -r test_requirements.txt | |
# pytest | |
- name: Clone and test pyspedas | |
run: | | |
git clone https://github.com/spedas/pyspedas.git | |
cd pyspedas | |
pip install -r requirements.txt | |
pip install mth5 | |
# Ignore 6 known failing tests, for now | |
pytest -k "not test_degpol and not test_elliptict and not test_helict and not test_powspec and not test_waveangle and not test_read_epde_calibration_data" | |
- name: Clone and test spacepy | |
run: | | |
git clone https://github.com/spacepy/spacepy.git | |
cd spacepy/tests | |
# python test_all.py | |
# Manually run all test files except 5 that cause problems | |
python test_ae9ap9.py | |
python test_base.py | |
python test_coordinates.py | |
python test_ctrans.py | |
python test_data_assimilation.py | |
python test_datamanager.py | |
python test_igrf.py | |
python test_irbempy.py | |
python test_lanlstar.py | |
python test_lib.py | |
python test_omni.py | |
python test_plot.py | |
python test_plot_utils.py | |
python test_poppy.py | |
python test_pybats.py | |
python test_rst.py | |
python test_seapy.py | |
python test_spectrogram.py | |
python test_testing.py | |
python test_time.py | |
# python test_toolbox.py | |
# SunPy always fails with "pytest: error: unrecognized arguments: --doctest-rst --dist --arraydiff" | |
# - name: Clone and test sunpy | |
# continue-on-error: true | |
# run: | | |
# git clone https://github.com/sunpy/sunpy.git | |
# cd sunpy | |
# # Extract dependencies from pyproject.toml | |
# python -c "import tomli; f=open('pyproject.toml', 'rb'); pyproject=tomli.load(f); f.close(); dependencies=pyproject.get('project', {}).get('dependencies', []); req_file=open('req_file.txt', 'w'); req_file.write('\n'.join(dependencies)); req_file.close()" | |
# pip install -r req_file.txt | |
# pytest |