cleaning tests

This commit is contained in:
Martin Diehl 2021-11-15 23:05:44 +01:00
parent 49a1cd6850
commit e2e80b9706
4 changed files with 21 additions and 10 deletions

View File

@ -136,7 +136,7 @@ compile_Marc:
- cp ${CI_PROJECT_DIR}/examples/Marc/* . - cp ${CI_PROJECT_DIR}/examples/Marc/* .
- python3 -c "import damask;damask.solver.Marc().submit_job('r-value','texture',True,'h')" - python3 -c "import damask;damask.solver.Marc().submit_job('r-value','texture',True,'h')"
- mkdir ${TESTROOT}/src - mkdir ${TESTROOT}/src
- mv ${CI_PROJECT_DIR}/src/DAMASK_Marc.marc - mv ${CI_PROJECT_DIR}/src/DAMASK_Marc.marc ${TESTROOT}/src
################################################################################################### ###################################################################################################
@ -145,13 +145,13 @@ open-source:
script: script:
- module load ${COMPILER_INTEL} ${MPI_INTEL} ${PETSC_INTEL} - module load ${COMPILER_INTEL} ${MPI_INTEL} ${PETSC_INTEL}
- cd PRIVATE/testing/pytest - cd PRIVATE/testing/pytest
- pytest -k 'not compile and not Marc' --basetemp ${TESTROOT}/fortran -v - pytest -k 'not compile and not Marc' --basetemp ${TESTROOT}/open-source -v
Marc: Marc:
stage: fortran stage: fortran
script: script:
- cd PRIVATE/testing/pytest - cd PRIVATE/testing/pytest
- pytest -k 'not compile and Marc' --damask-root ${TESTROOT} --basetemp ${TESTROOT}/fortran -v - pytest -k 'not compile and Marc' --damask-root=${TESTROOT} --basetemp ${TESTROOT}/Marc -v
# Needs closer look # Needs closer look
# Phenopowerlaw_singleSlip: # Phenopowerlaw_singleSlip:
@ -169,7 +169,11 @@ grid_runtime:
- make -j2 all install - make -j2 all install
- REPO_DIR=$(mktemp -d) - REPO_DIR=$(mktemp -d)
- git clone -q git@git.damask.mpie.de:damask/performance.git ${REPO_DIR} - git clone -q git@git.damask.mpie.de:damask/performance.git ${REPO_DIR}
- ./PRIVATE/testing/runtime.py --input_dir ${CI_PROJECT_DIR}/examples/grid --output_dir ${REPO_DIR} --tag ${CI_COMMIT_SHA} - >
${CI_PROJECT_DIR}/PRIVATE/testing/runtime.py
--input_dir ${CI_PROJECT_DIR}/examples/grid
--output_dir ${REPO_DIR}
--tag ${CI_COMMIT_SHA}
- if [ ${CI_COMMIT_BRANCH} == development ]; then git commit -am ${CI_PIPELINE_ID}_${CI_COMMIT_SHA}; git push; fi - if [ ${CI_COMMIT_BRANCH} == development ]; then git commit -am ${CI_PIPELINE_ID}_${CI_COMMIT_SHA}; git push; fi
before_script: before_script:
- ${LOCAL_HOME}/bin/queue ${CI_JOB_ID} --blocking - ${LOCAL_HOME}/bin/queue ${CI_JOB_ID} --blocking

@ -1 +1 @@
Subproject commit 6b7dfd6e618cccba87ef6640dfd1f8556d235c23 Subproject commit 7a7588973a9ab48a4980fd67d59ffce7030d71aa

View File

@ -49,9 +49,8 @@ def patch_plt_show(monkeypatch):
def pytest_addoption(parser): def pytest_addoption(parser):
parser.addoption("--update", parser.addoption('--update', action='store_true', default=False,
action="store_true", help='Update reference results.')
default=False)
@pytest.fixture @pytest.fixture

View File

@ -989,11 +989,19 @@ class TestRotation:
with pytest.raises(TypeError): with pytest.raises(TypeError):
R@data R@data
def test_misorientation(self): def test_misorientation_invariant(self):
R = Rotation.from_random() R = Rotation.from_random()
assert np.allclose(R.misorientation(R).as_matrix(),np.eye(3)) assert np.allclose(R.misorientation(R).as_matrix(),np.eye(3))
def test_misorientation360(self): def test_misorientation_average(self):
"""2 times the average is the misorientation."""
r = Rotation.from_random(2)
a = r[0].misorientation(r[1]).as_axis_angle()
b = r.average().misorientation(r[1]).as_axis_angle()
b[3] = (b[3]*2)%np.pi
assert np.allclose(a,b)
def test_misorientation_360deg(self):
R_1 = Rotation() R_1 = Rotation()
R_2 = Rotation.from_Euler_angles([360,0,0],degrees=True) R_2 = Rotation.from_Euler_angles([360,0,0],degrees=True)
assert np.allclose(R_1.misorientation(R_2).as_matrix(),np.eye(3)) assert np.allclose(R_1.misorientation(R_2).as_matrix(),np.eye(3))