Skip to content

Commit

Permalink
More sophisticate pytest running option.
Browse files Browse the repository at this point in the history
  • Loading branch information
unkcpz committed Jun 21, 2024
1 parent 12521bc commit f4f3cfa
Show file tree
Hide file tree
Showing 10 changed files with 135 additions and 133 deletions.
35 changes: 28 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,18 @@ on: [push, pull_request]

jobs:

fast-tests:

fast-tests:
runs-on: ubuntu-latest
timeout-minutes: 10

services:
rabbitmq:
image: rabbitmq:3.8.14-management
ports:
- 5672:5672
- 15672:15672

steps:
- uses: actions/checkout@v4

Expand All @@ -24,16 +31,23 @@ jobs:
run: |
pip install .[dev]
- name: Pull the image and Run pytest
- name: Run pytest
run: |
pytest -v tests -m "not slow"
pytest -s tests -m "not slow"
slow-tests:

needs: [fast-tests]
runs-on: ubuntu-latest
timeout-minutes: 30

services:
rabbitmq:
image: rabbitmq:3.8.14-management
ports:
- 5672:5672
- 15672:15672

steps:
- uses: actions/checkout@v4

Expand All @@ -46,9 +60,9 @@ jobs:
run: |
pip install .[dev]
- name: Pull the image and Run pytest
- name: Run pytest
run: |
pytest -v tests -m "slow"
pytest -s tests -m "slow"
edge-aiida-core-tests:
# This is to test the plugin is compatible with the main branch of aiida-core
Expand All @@ -57,6 +71,13 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 30

services:
rabbitmq:
image: rabbitmq:3.8.14-management
ports:
- 5672:5672
- 15672:15672

steps:
- uses: actions/checkout@v4

Expand All @@ -81,6 +102,6 @@ jobs:
exit 1
fi
- name: Pull the image and Run pytest
- name: Run pytest
run: |
pytest -v tests
pytest -s tests
4 changes: 3 additions & 1 deletion tests/utils/test_structure.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import pytest
import itertools
import numpy as np

from aiida.engine import run_get_node
from aiida import orm
Expand Down Expand Up @@ -47,8 +48,9 @@ def test_get_standard_structure(element, configuration, data_regression):
r, _ = run_get_node(
get_standard_structure, element=element, configuration=configuration
)
ase_r = r.get_ase()

data_regression.check(r.get_cif().get_content())
data_regression.check({k: np.round(v, 3).tolist() for k, v in ase_r.arrays.items()})


@pytest.mark.parametrize(
Expand Down
23 changes: 8 additions & 15 deletions tests/utils/test_structure/test_get_standard_structure_Fe_BCC_.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
"\n##########################################################################\n# \
\ Crystallographic Information Format file\n# Produced\
\ by PyCifRW module\n#\n# This is a CIF file. CIF has been adopted by the International\n\
# Union of Crystallography as the standard for data archiving and\n# transmission.\n\
#\n# For information on this file format, follow the CIF links at\n# http://www.iucr.org\n\
##########################################################################\n\ndata_0\n\
\nloop_\n _atom_site_label\n _atom_site_fract_x\n _atom_site_fract_y\n _atom_site_fract_z\n\
\ _atom_site_type_symbol\n Fe1 0.0 0.0 0.0 Fe \n\
_cell_angle_alpha 109.47122063449069\n_cell_angle_beta \
\ 109.47122063449069\n_cell_angle_gamma \
\ 109.47122063449069\n_cell_length_a 2.389785699289135\n\
_cell_length_b 2.389785699289135\n_cell_length_c \
\ 2.389785699289135\nloop_\n _symmetry_equiv_pos_as_xyz\n \
\ 'x, y, z' \n_symmetry_int_tables_number 1\n_symmetry_space_group_name_H-M\
\ 'P 1'"
masses:
- 55.845
numbers:
- 26
positions:
- - 0.0
- 0.0
- 0.0
29 changes: 13 additions & 16 deletions tests/utils/test_structure/test_get_standard_structure_Fe_DC_.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
"\n##########################################################################\n# \
\ Crystallographic Information Format file\n# Produced\
\ by PyCifRW module\n#\n# This is a CIF file. CIF has been adopted by the International\n\
# Union of Crystallography as the standard for data archiving and\n# transmission.\n\
#\n# For information on this file format, follow the CIF links at\n# http://www.iucr.org\n\
##########################################################################\n\ndata_0\n\
\nloop_\n _atom_site_label\n _atom_site_fract_x\n _atom_site_fract_y\n _atom_site_fract_z\n\
\ _atom_site_type_symbol\n Fe1 0.0 0.0 0.0 Fe \
\ \n Fe2 0.24999999999998976 0.24999999999998976 \
\ 0.24999999999998976 Fe\n_cell_angle_alpha \
\ 60.00000000000001\n_cell_angle_beta 60.00000000000001\n\
_cell_angle_gamma 60.00000000000001\n_cell_length_a \
\ 3.4460197248582936\n_cell_length_b \
\ 3.4460197248582936\n_cell_length_c 3.4460197248582936\n\
loop_\n _symmetry_equiv_pos_as_xyz\n 'x, y, z' \n_symmetry_int_tables_number\
\ 1\n_symmetry_space_group_name_H-M 'P 1'"
masses:
- 55.845
- 55.845
numbers:
- 26
- 26
positions:
- - 0.0
- 0.0
- 0.0
- - 1.218
- 1.218
- 1.218
27 changes: 13 additions & 14 deletions tests/utils/test_structure/test_get_standard_structure_Fe_GS_.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
"\n##########################################################################\n# \
\ Crystallographic Information Format file\n# Produced\
\ by PyCifRW module\n#\n# This is a CIF file. CIF has been adopted by the International\n\
# Union of Crystallography as the standard for data archiving and\n# transmission.\n\
#\n# For information on this file format, follow the CIF links at\n# http://www.iucr.org\n\
##########################################################################\n\ndata_0\n\
\nloop_\n _atom_site_label\n _atom_site_fract_x\n _atom_site_fract_y\n _atom_site_fract_z\n\
\ _atom_site_type_symbol\n Fe1 0.0 0.0 0.0 Fe \
\ \n Fe2 0.5 0.5 0.5 Fe \n_cell_angle_alpha\
\ 90.0\n_cell_angle_beta 90.0\n_cell_angle_gamma\
\ 90.0\n_cell_length_a 2.83351\n\
_cell_length_b 2.83351\n_cell_length_c \
\ 2.83351\nloop_\n _symmetry_equiv_pos_as_xyz\n 'x, y, z' \n_symmetry_int_tables_number\
\ 1\n_symmetry_space_group_name_H-M 'P 1'"
masses:
- 55.845
- 55.845
numbers:
- 26
- 26
positions:
- - 0.0
- 0.0
- 0.0
- - 1.417
- 1.417
- 1.417
29 changes: 13 additions & 16 deletions tests/utils/test_structure/test_get_standard_structure_La_DC_.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
"\n##########################################################################\n# \
\ Crystallographic Information Format file\n# Produced\
\ by PyCifRW module\n#\n# This is a CIF file. CIF has been adopted by the International\n\
# Union of Crystallography as the standard for data archiving and\n# transmission.\n\
#\n# For information on this file format, follow the CIF links at\n# http://www.iucr.org\n\
##########################################################################\n\ndata_0\n\
\nloop_\n _atom_site_label\n _atom_site_fract_x\n _atom_site_fract_y\n _atom_site_fract_z\n\
\ _atom_site_type_symbol\n La1 0.5 0.5 0.5 La \
\ \n La2 0.75 0.7499999999999998 0.7500000000000001 La\
\ \n_cell_angle_alpha 59.99999999999999\n_cell_angle_beta\
\ 59.99999999999999\n_cell_angle_gamma \
\ 59.99999999999999\n_cell_length_a 4.727360973810436\n\
_cell_length_b 4.727360973810436\n_cell_length_c \
\ 4.727360973810436\nloop_\n _symmetry_equiv_pos_as_xyz\n \
\ 'x, y, z' \n_symmetry_int_tables_number 1\n_symmetry_space_group_name_H-M\
\ 'P 1'"
masses:
- 138.905
- 138.905
numbers:
- 57
- 57
positions:
- - 0.0
- 0.0
- 3.343
- - 1.671
- 5.014
- 1.671
29 changes: 13 additions & 16 deletions tests/utils/test_structure/test_get_standard_structure_La_LAN_.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
"\n##########################################################################\n# \
\ Crystallographic Information Format file\n# Produced\
\ by PyCifRW module\n#\n# This is a CIF file. CIF has been adopted by the International\n\
# Union of Crystallography as the standard for data archiving and\n# transmission.\n\
#\n# For information on this file format, follow the CIF links at\n# http://www.iucr.org\n\
##########################################################################\n\ndata_0\n\
\nloop_\n _atom_site_label\n _atom_site_fract_x\n _atom_site_fract_y\n _atom_site_fract_z\n\
\ _atom_site_type_symbol\n La1 0.0 0.0 0.0 La \
\ \n N1 0.5 0.5 0.5 N \n_cell_angle_alpha\
\ 59.99999999999999\n_cell_angle_beta \
\ 59.99999999999999\n_cell_angle_gamma 59.99999999999999\n\
_cell_length_a 3.758950000000038\n_cell_length_b \
\ 3.758950000000038\n_cell_length_c \
\ 3.758950000000038\nloop_\n _symmetry_equiv_pos_as_xyz\n 'x, y, z' \n\
_symmetry_int_tables_number 1\n_symmetry_space_group_name_H-M \
\ 'P 1'"
masses:
- 138.905
- 14.007
numbers:
- 57
- 7
positions:
- - 0.0
- 0.0
- 0.0
- - 0.0
- 2.658
- 0.0
29 changes: 13 additions & 16 deletions tests/utils/test_structure/test_get_standard_structure_La_XO_.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
"\n##########################################################################\n# \
\ Crystallographic Information Format file\n# Produced\
\ by PyCifRW module\n#\n# This is a CIF file. CIF has been adopted by the International\n\
# Union of Crystallography as the standard for data archiving and\n# transmission.\n\
#\n# For information on this file format, follow the CIF links at\n# http://www.iucr.org\n\
##########################################################################\n\ndata_0\n\
\nloop_\n _atom_site_label\n _atom_site_fract_x\n _atom_site_fract_y\n _atom_site_fract_z\n\
\ _atom_site_type_symbol\n La1 0.0 0.0 0.0 La \
\ \n O1 0.49999999999999994 0.5 0.5 O\
\ \n_cell_angle_alpha 59.99999999999999\n_cell_angle_beta\
\ 59.99999999999999\n_cell_angle_gamma \
\ 59.99999999999999\n_cell_length_a 3.6515633298742327\n\
_cell_length_b 3.6515633298742327\n_cell_length_c \
\ 3.6515633298742327\nloop_\n _symmetry_equiv_pos_as_xyz\n\
\ 'x, y, z' \n_symmetry_int_tables_number 1\n_symmetry_space_group_name_H-M\
\ 'P 1'"
masses:
- 138.905
- 15.999
numbers:
- 57
- 8
positions:
- - 0.0
- 0.0
- 0.0
- - 0.0
- 2.582
- 0.0
29 changes: 13 additions & 16 deletions tests/utils/test_structure/test_get_standard_structure_Te_DC_.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
"\n##########################################################################\n# \
\ Crystallographic Information Format file\n# Produced\
\ by PyCifRW module\n#\n# This is a CIF file. CIF has been adopted by the International\n\
# Union of Crystallography as the standard for data archiving and\n# transmission.\n\
#\n# For information on this file format, follow the CIF links at\n# http://www.iucr.org\n\
##########################################################################\n\ndata_0\n\
\nloop_\n _atom_site_label\n _atom_site_fract_x\n _atom_site_fract_y\n _atom_site_fract_z\n\
\ _atom_site_type_symbol\n Te1 0.5 0.5 0.5 Te \
\ \n Te2 0.7499999999999931 0.7499999999999929 0.7499999999999931\
\ Te\n_cell_angle_alpha 59.99999999999999\n_cell_angle_beta\
\ 59.99999999999999\n_cell_angle_gamma \
\ 59.99999999999999\n_cell_length_a 5.082361105318261\n\
_cell_length_b 5.082361105318261\n_cell_length_c \
\ 5.082361105318261\nloop_\n _symmetry_equiv_pos_as_xyz\n \
\ 'x, y, z' \n_symmetry_int_tables_number 1\n_symmetry_space_group_name_H-M\
\ 'P 1'"
masses:
- 127.6
- 127.6
numbers:
- 52
- 52
positions:
- - 0.0
- 0.0
- 3.594
- - 1.797
- 5.391
- 1.797
34 changes: 18 additions & 16 deletions tests/utils/test_structure/test_get_standard_structure_Te_GS_.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
"\n##########################################################################\n# \
\ Crystallographic Information Format file\n# Produced\
\ by PyCifRW module\n#\n# This is a CIF file. CIF has been adopted by the International\n\
# Union of Crystallography as the standard for data archiving and\n# transmission.\n\
#\n# For information on this file format, follow the CIF links at\n# http://www.iucr.org\n\
##########################################################################\n\ndata_0\n\
\nloop_\n _atom_site_label\n _atom_site_fract_x\n _atom_site_fract_y\n _atom_site_fract_z\n\
\ _atom_site_type_symbol\n Te1 0.7303400000000044 0.7303400000000088\
\ 0.5 Te \n Te2 0.9999999999999957 0.26965999999999135\
\ 0.16666666666666666 Te \n Te3 0.26966 \
\ 0.0 0.8333333333333333 Te \n_cell_angle_alpha 90.0\n\
_cell_angle_beta 90.0\n_cell_angle_gamma \
\ 119.99999999999997\n_cell_length_a 4.50788\n_cell_length_b\
\ 4.507880000000004\n_cell_length_c \
\ 5.96346\nloop_\n _symmetry_equiv_pos_as_xyz\n 'x, y, z' \n_symmetry_int_tables_number\
\ 1\n_symmetry_space_group_name_H-M 'P 1'"
masses:
- 127.6
- 127.6
- 127.6
numbers:
- 52
- 52
- 52
positions:
- - 1.646
- 2.851
- 2.982
- - -0.608
- 1.053
- 0.994
- - 1.216
- 0.0
- 4.97

0 comments on commit f4f3cfa

Please sign in to comment.