From 4cc63c71a16caeaffd919cdfc4655e84f2cfdcb8 Mon Sep 17 00:00:00 2001 From: vhirtham <20574817+vhirtham@users.noreply.github.com> Date: Wed, 20 Jul 2022 17:11:37 +0200 Subject: [PATCH 1/4] Add cookiecutter to pytest --- .github/workflows/pytest.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 33f308573..d2c0c3047 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -85,6 +85,11 @@ jobs: run: | pytest --cov-append ./weldx/tests/asdf_tests/quality_standards_check.py + - name: install cookiecutter + if: matrix.py == '3.8' + run: | + pip install cookiecutter + - name: coverage xml (combination is performed by pytest-cov) if: matrix.py == '3.8' run: coverage xml From 19aebacc5cd40fc0d4d939c40aaa11e2f58d25f4 Mon Sep 17 00:00:00 2001 From: vhirtham <20574817+vhirtham@users.noreply.github.com> Date: Wed, 20 Jul 2022 17:15:22 +0200 Subject: [PATCH 2/4] Run cookiecutter --- .github/workflows/pytest.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index d2c0c3047..69976a472 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -90,6 +90,11 @@ jobs: run: | pip install cookiecutter + - name: create installable quality standard from repo + if: matrix.py == '3.8' + run: | + cookiecutter --no-input https://github.com/BAMWeldx/quality-standard-template + - name: coverage xml (combination is performed by pytest-cov) if: matrix.py == '3.8' run: coverage xml From 39b662d1a5d9b61c8cb24535e82de03f76a6aace Mon Sep 17 00:00:00 2001 From: vhirtham <20574817+vhirtham@users.noreply.github.com> Date: Wed, 20 Jul 2022 17:50:05 +0200 Subject: [PATCH 3/4] Add test for installable QS --- .github/workflows/pytest.yml | 10 ++++++++++ .../installable_quality_standard_check.py | 20 +++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 weldx/tests/asdf_tests/installable_quality_standard_check.py diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 69976a472..11a292286 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -95,6 +95,16 @@ jobs: run: | cookiecutter --no-input https://github.com/BAMWeldx/quality-standard-template + - name: install quality standard + if: matrix.py == '3.8' + run: | + pip install -e ./quality_standard_demo + + - name: test installable quality standard from template repository + if: matrix.py == '3.8' + run: | + pytest --cov-append ./weldx/tests/asdf_tests/installable_quality_standards_check.py + - name: coverage xml (combination is performed by pytest-cov) if: matrix.py == '3.8' run: coverage xml diff --git a/weldx/tests/asdf_tests/installable_quality_standard_check.py b/weldx/tests/asdf_tests/installable_quality_standard_check.py new file mode 100644 index 000000000..c7769aa48 --- /dev/null +++ b/weldx/tests/asdf_tests/installable_quality_standard_check.py @@ -0,0 +1,20 @@ +import pytest +from asdf import ValidationError + +from weldx import WeldxFile +from weldx.config import enable_quality_standard +from weldx.measurement import MeasurementEquipment + + +def test_installable_quality_standard(): + enable_quality_standard("quality_standard_demo") + + eq = MeasurementEquipment("Equipment") + + tree = dict(equip=eq) + + with pytest.raises(ValidationError): + WeldxFile(tree=tree, mode="rw") + + eq.wx_metadata = {"serial_number": 1234} + WeldxFile(tree=tree, mode="rw") From aeef1d1e3e7befbf9156f6f130e2b60bc4662dd5 Mon Sep 17 00:00:00 2001 From: vhirtham <20574817+vhirtham@users.noreply.github.com> Date: Wed, 20 Jul 2022 18:03:17 +0200 Subject: [PATCH 4/4] fix typo --- .github/workflows/pytest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 11a292286..74a53cd97 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -103,7 +103,7 @@ jobs: - name: test installable quality standard from template repository if: matrix.py == '3.8' run: | - pytest --cov-append ./weldx/tests/asdf_tests/installable_quality_standards_check.py + pytest --cov-append ./weldx/tests/asdf_tests/installable_quality_standard_check.py - name: coverage xml (combination is performed by pytest-cov) if: matrix.py == '3.8'