Skip to content

Commit 44a2663

Browse files
authored
Generate unit tests for Python (#580)
We move the generator for unit test code from individual SDK repositories to the aas-core-codegen repository so that we can move faster between the actual meta-model versions. In addition, we want to decouple the generation of the SDK from the actual version. Earlier, we could not do that as we kept most of the test data wrapped into an AAS environment, so it did not fit the aas-core-codegen principle to be agnostic of AAS. In the meantime, we generate the test data per meta-model class, and not wrapped in Environment class, in [aas-core-testdatagen], so now generating general unit tests is possible. [aas-core-testdatagen]: https://github.com/aas-core-works/aas-core-testdatagen
1 parent b8779a4 commit 44a2663

File tree

55 files changed

+12413
-117
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+12413
-117
lines changed

.github/workflows/ci.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,26 @@ jobs:
3232
run: pip3 install --upgrade coveralls
3333
if: github.event.repository.fork == false
3434

35+
# NOTE (mristin):
36+
# We run this command to detect nasty errors such as import cycles early.
37+
- name: Run --help to check that the command works
38+
run: aas-core-codegen --help
39+
3540
# NOTE (mristin):
3641
# We introduce this check as a fast-fail.
3742
- name: Check help in readme
38-
run: python3 dev/continuous_integration/precommit.py --select check-help-in-readme
43+
run: |
44+
python3 dev/continuous_integration/precommit.py \
45+
--select check-help-in-readme
3946
4047
# NOTE (mristin):
4148
# We introduce this check as a fast-fail.
4249
- name: Check that __init__.py and pyproject.toml are consistent
43-
run: python3 dev/continuous_integration/precommit.py --select check-init-and-pyproject-consistent
50+
run: |
51+
python3 dev/continuous_integration/precommit.py \
52+
--select check-init-and-pyproject-consistent
4453
45-
- name: Run the checks except testing
54+
- name: Run the other checks except testing
4655
run: |
4756
python3 dev/continuous_integration/precommit.py \
4857
--skip \

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ dist/
2323
downloads/
2424
eggs/
2525
.eggs/
26-
lib/
2726
lib64/
2827
parts/
2928
sdist/

aas_core_codegen/python/aas_common/__init__.py

Lines changed: 0 additions & 4 deletions
This file was deleted.

aas_core_codegen/python/constants/__init__.py

Lines changed: 0 additions & 5 deletions
This file was deleted.

aas_core_codegen/python/jsonization/__init__.py

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
"""Provide generators for the main module."""
2+
3+
from aas_core_codegen.python.lib import (
4+
_generate_common,
5+
_generate_constants,
6+
_generate_jsonization,
7+
_generate_stringification,
8+
_generate_types,
9+
_generate_verification,
10+
_generate_xmlization,
11+
)
12+
13+
generate_common = _generate_common.generate
14+
15+
generate_constants = _generate_constants.generate
16+
17+
generate_jsonization = _generate_jsonization.generate
18+
19+
generate_stringification = _generate_stringification.generate
20+
21+
generate_types = _generate_types.generate
22+
verify_for_types = _generate_types.verify
23+
24+
generate_verification = _generate_verification.generate
25+
verify_for_verification = _generate_verification.verify
26+
27+
generate_xmlization = _generate_xmlization.generate
File renamed without changes.
File renamed without changes.

aas_core_codegen/python/jsonization/_generate.py renamed to aas_core_codegen/python/lib/_generate_jsonization.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,6 @@ def _try_to_cast_to_array_like(
224224
{I}>>> assert _try_to_cast_to_array_like({{1, 2, 3}}) is None
225225
{I}"""
226226
{I}if (
227-
{II}
228227
{II}not isinstance(jsonable, (str, bytearray, bytes))
229228
{II}and hasattr(jsonable, "__iter__")
230229
{II}and not hasattr(jsonable, "keys")

aas_core_codegen/python/stringification/_generate.py renamed to aas_core_codegen/python/lib/_generate_stringification.py

File renamed without changes.

0 commit comments

Comments
 (0)