From a349766bf53adcb8d0265f0715b6f448605dc1ea Mon Sep 17 00:00:00 2001 From: Chris Sewell Date: Fri, 30 Apr 2021 23:32:47 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=AA=20TESTS:=20Update=20CI=20to=20pyth?= =?UTF-8?q?on=203.7,3.8,3.9=20(#24)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit and also for different lammps versions --- .github/workflows/tests.yml | 28 ++++++----- aiida_lammps/tests/test_calculations.py | 7 ++- ..._eam_.yml => test_md_process-eam-2019.yml} | 0 .../test_md_process-eam-2020.yml | 32 +++++++++++++ ...=> test_md_process-lennard-jones-2019.yml} | 0 .../test_md_process-lennard-jones-2020.yml | 32 +++++++++++++ ..._.yml => test_md_process-tersoff-2019.yml} | 0 .../test_md_process-tersoff-2020.yml | 33 +++++++++++++ .../test_md_process_reaxff_.yml | 48 ------------------- conftest.py | 4 +- setup.json | 2 +- tox.ini | 4 +- 12 files changed, 124 insertions(+), 66 deletions(-) rename aiida_lammps/tests/test_calculations/{test_md_process_eam_.yml => test_md_process-eam-2019.yml} (100%) create mode 100644 aiida_lammps/tests/test_calculations/test_md_process-eam-2020.yml rename aiida_lammps/tests/test_calculations/{test_md_process_lennard_jones_.yml => test_md_process-lennard-jones-2019.yml} (100%) create mode 100644 aiida_lammps/tests/test_calculations/test_md_process-lennard-jones-2020.yml rename aiida_lammps/tests/test_calculations/{test_md_process_tersoff_.yml => test_md_process-tersoff-2019.yml} (100%) create mode 100644 aiida_lammps/tests/test_calculations/test_md_process-tersoff-2020.yml delete mode 100644 aiida_lammps/tests/test_calculations/test_md_process_reaxff_.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index fc9f6cc..1c726ea 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -17,7 +17,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v1 with: - python-version: 3.7 + python-version: 3.8 - uses: pre-commit/action@v2.0.0 tests: @@ -27,17 +27,21 @@ jobs: strategy: fail-fast: false matrix: - python-version: [3.6, 3.7] - # TODO 3.8 is not compatible with lammps==2019.06.05, - # but the 2020 version changes the test results (1 more trajectory step) - os: [ubuntu-latest] - backend: ['django'] include: - python-version: 3.7 - os: ubuntu-latest + lammps-version: "2019.06.05" + backend: django + - python-version: 3.7 + lammps-version: "2019.06.05" backend: sqlalchemy + - python-version: 3.8 + lammps-version: "2020.12.24" + backend: django + - python-version: 3.9 + lammps-version: "2020.12.24" + backend: django - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest services: postgres: @@ -69,7 +73,7 @@ jobs: conda-channels: conda-forge - name: install lammps - run: conda install -y lammps==2019.06.05 + run: conda install -y lammps==${{ matrix.lammps-version }} - name: Upgrade pip run: | @@ -89,7 +93,7 @@ jobs: if: matrix.os == 'ubuntu-latest' && matrix.python-version == 3.7 uses: codecov/codecov-action@v1 with: - name: pytests-py3.7 + name: pytests-lammps flags: pytests file: ./coverage.xml fail_ci_if_error: true @@ -102,10 +106,10 @@ jobs: steps: - name: Checkout source uses: actions/checkout@v2 - - name: Set up Python 3.7 + - name: Set up Python uses: actions/setup-python@v1 with: - python-version: 3.7 + python-version: 3.8 - name: Build package run: | pip install wheel diff --git a/aiida_lammps/tests/test_calculations.py b/aiida_lammps/tests/test_calculations.py index 97631ec..1d8d72d 100644 --- a/aiida_lammps/tests/test_calculations.py +++ b/aiida_lammps/tests/test_calculations.py @@ -354,8 +354,10 @@ def test_md_process(db_test_app, get_potential_data, potential_type, data_regres code = db_test_app.get_or_create_code(calc_plugin) pot_data = get_potential_data(potential_type) potential = DataFactory("lammps.potential")(type=pot_data.type, data=pot_data.data) + version = get_lammps_version(code) + version_year = version[-4:] parameters = get_calc_parameters( - get_lammps_version(code), calc_plugin, potential.default_units, potential_type + version, calc_plugin, potential.default_units, potential_type ) builder = code.get_builder() builder._update( @@ -386,7 +388,8 @@ def test_md_process(db_test_app, get_potential_data, potential_type, data_regres ), "system_data": calc_node.outputs.system_data.attributes, "trajectory_data": calc_node.outputs.trajectory_data.attributes, - } + }, + basename=f"test_md_process-{potential_type}-{version_year}", ) diff --git a/aiida_lammps/tests/test_calculations/test_md_process_eam_.yml b/aiida_lammps/tests/test_calculations/test_md_process-eam-2019.yml similarity index 100% rename from aiida_lammps/tests/test_calculations/test_md_process_eam_.yml rename to aiida_lammps/tests/test_calculations/test_md_process-eam-2019.yml diff --git a/aiida_lammps/tests/test_calculations/test_md_process-eam-2020.yml b/aiida_lammps/tests/test_calculations/test_md_process-eam-2020.yml new file mode 100644 index 0000000..f53067f --- /dev/null +++ b/aiida_lammps/tests/test_calculations/test_md_process-eam-2020.yml @@ -0,0 +1,32 @@ +results: + distance_units: Angstroms + energy: -8.1 + energy_units: eV + errors: [] + parser_class: MdParser + time_units: picoseconds + timestep_picoseconds: 0.001 + units_style: metal +system_data: + array|etotal: + - 101 + array|step: + - 101 + array|temp: + - 101 + units_style: metal +trajectory_data: + aliases: null + compression_method: 8 + elements: + - Fe + field_names: + - element + - x + - y + - z + number_atoms: 2 + number_steps: 101 + timestep_filename: timesteps.txt + traj_filename: trajectory.zip + zip_prefix: step- diff --git a/aiida_lammps/tests/test_calculations/test_md_process_lennard_jones_.yml b/aiida_lammps/tests/test_calculations/test_md_process-lennard-jones-2019.yml similarity index 100% rename from aiida_lammps/tests/test_calculations/test_md_process_lennard_jones_.yml rename to aiida_lammps/tests/test_calculations/test_md_process-lennard-jones-2019.yml diff --git a/aiida_lammps/tests/test_calculations/test_md_process-lennard-jones-2020.yml b/aiida_lammps/tests/test_calculations/test_md_process-lennard-jones-2020.yml new file mode 100644 index 0000000..ad11d0e --- /dev/null +++ b/aiida_lammps/tests/test_calculations/test_md_process-lennard-jones-2020.yml @@ -0,0 +1,32 @@ +results: + distance_units: Angstroms + energy: 0.1 + energy_units: eV + errors: [] + parser_class: MdParser + time_units: picoseconds + timestep_picoseconds: 0.001 + units_style: metal +system_data: + array|etotal: + - 101 + array|step: + - 101 + array|temp: + - 101 + units_style: metal +trajectory_data: + aliases: null + compression_method: 8 + elements: + - Ar + field_names: + - element + - x + - y + - z + number_atoms: 2 + number_steps: 101 + timestep_filename: timesteps.txt + traj_filename: trajectory.zip + zip_prefix: step- diff --git a/aiida_lammps/tests/test_calculations/test_md_process_tersoff_.yml b/aiida_lammps/tests/test_calculations/test_md_process-tersoff-2019.yml similarity index 100% rename from aiida_lammps/tests/test_calculations/test_md_process_tersoff_.yml rename to aiida_lammps/tests/test_calculations/test_md_process-tersoff-2019.yml diff --git a/aiida_lammps/tests/test_calculations/test_md_process-tersoff-2020.yml b/aiida_lammps/tests/test_calculations/test_md_process-tersoff-2020.yml new file mode 100644 index 0000000..8623818 --- /dev/null +++ b/aiida_lammps/tests/test_calculations/test_md_process-tersoff-2020.yml @@ -0,0 +1,33 @@ +results: + distance_units: Angstroms + energy: -17.8 + energy_units: eV + errors: [] + parser_class: MdParser + time_units: picoseconds + timestep_picoseconds: 0.001 + units_style: metal +system_data: + array|etotal: + - 101 + array|step: + - 101 + array|temp: + - 101 + units_style: metal +trajectory_data: + aliases: null + compression_method: 8 + elements: + - Ga + - N + field_names: + - element + - x + - y + - z + number_atoms: 4 + number_steps: 101 + timestep_filename: timesteps.txt + traj_filename: trajectory.zip + zip_prefix: step- diff --git a/aiida_lammps/tests/test_calculations/test_md_process_reaxff_.yml b/aiida_lammps/tests/test_calculations/test_md_process_reaxff_.yml deleted file mode 100644 index 83f8d0d..0000000 --- a/aiida_lammps/tests/test_calculations/test_md_process_reaxff_.yml +++ /dev/null @@ -1,48 +0,0 @@ -results: - distance_units: Angstroms - energy: -1018.2 - energy_units: Kcal/mole - errors: [] - parser_class: MdParser - time_units: femtoseconds - units_style: real - warnings: '' -system_data: - array|c_reax_1_: - - 100 - array|etotal: - - 100 - array|step: - - 100 - array|temp: - - 100 - units_style: real -trajectory_data: - array|cells: - - 101 - - 3 - - 3 - array|charges: - - 101 - - 12 - array|positions: - - 101 - - 12 - - 3 - array|steps: - - 101 - array|times: - - 101 - symbols: - - Fe - - Fe - - Fe - - Fe - - S - - S - - S - - S - - S - - S - - S - - S diff --git a/conftest.py b/conftest.py index d20dbfe..1c0c630 100644 --- a/conftest.py +++ b/conftest.py @@ -48,7 +48,9 @@ def get_work_directory(config): def pytest_report_header(config): """Add header information for pytest execution.""" return [ - "LAMMPS Executable: {}".format(config.getoption("lammps_exec") or "lammps"), + "LAMMPS Executable: {}".format( + shutil.which(config.getoption("lammps_exec") or "lammps") + ), "LAMMPS Work Directory: {}".format( config.getoption("lammps_workdir") or "" ), diff --git a/setup.json b/setup.json index 1758dd1..07811f6 100644 --- a/setup.json +++ b/setup.json @@ -9,9 +9,9 @@ "classifiers": [ "Programming Language :: Python", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", "Topic :: Scientific/Engineering :: Chemistry", "Topic :: Scientific/Engineering :: Physics", "Framework :: AiiDA" diff --git a/tox.ini b/tox.ini index 63876d0..4591562 100644 --- a/tox.ini +++ b/tox.ini @@ -1,10 +1,10 @@ [tox] -envlist = py{36,37,38} +envlist = py37 [testenv] use_develop = true -[testenv:py{36,37,38}] +[testenv:py{37,38,39}] extras = testing deps = black