Skip to content

Commit

Permalink
compliance-tool: Fix compliance tool imports and unitests (#356)
Browse files Browse the repository at this point in the history
Currently, there are several wrong imports and
outdated unittests in the `compliance-tool` 
package.

This fixes these issues.

Fixes #354
  • Loading branch information
Frosty2500 authored Jan 15, 2025
1 parent 9cb5b89 commit 1ca495f
Show file tree
Hide file tree
Showing 20 changed files with 83 additions and 75 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.10", "3.12"]
python-version: ["3.9", "3.12"]
defaults:
run:
working-directory: ./compliance_tool
Expand Down Expand Up @@ -224,10 +224,10 @@ jobs:
working-directory: ./compliance_tool
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ env.X_PYTHON_VERSION }}
- name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }}
uses: actions/setup-python@v2
with:
python-version: ${{ env.X_PYTHON_VERSION }}
python-version: ${{ env.X_PYTHON_MIN_VERSION }}
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
Expand All @@ -249,10 +249,10 @@ jobs:
working-directory: ./compliance_tool
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ env.X_PYTHON_VERSION }}
- name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }}
uses: actions/setup-python@v2
with:
python-version: ${{ env.X_PYTHON_VERSION }}
python-version: ${{ env.X_PYTHON_MIN_VERSION }}
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
Expand All @@ -277,10 +277,10 @@ jobs:
working-directory: ./compliance_tool
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ env.X_PYTHON_VERSION }}
- name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }}
uses: actions/setup-python@v2
with:
python-version: ${{ env.X_PYTHON_VERSION }}
python-version: ${{ env.X_PYTHON_MIN_VERSION }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
File renamed without changes.
9 changes: 5 additions & 4 deletions compliance_tool/aas_compliance_tool/cli.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2020 the Eclipse BaSyx Authors
# Copyright (c) 2024 the Eclipse BaSyx Authors
#
# This program and the accompanying materials are made available under the terms of the MIT License, available in
# the LICENSE file of this project.
Expand All @@ -19,11 +19,12 @@

from basyx.aas.adapter import aasx
from basyx.aas.adapter.xml import write_aas_xml_file
from basyx.aas.compliance_tool import compliance_check_xml as compliance_tool_xml, \
compliance_check_json as compliance_tool_json, compliance_check_aasx as compliance_tool_aasx
from aas_compliance_tool import compliance_check_xml as compliance_tool_xml, \
compliance_check_json as compliance_tool_json, \
compliance_check_aasx as compliance_tool_aasx
from basyx.aas.adapter.json import write_aas_json_file
from basyx.aas.examples.data import create_example, create_example_aas_binding, TEST_PDF_FILE
from basyx.aas.compliance_tool.state_manager import ComplianceToolStateManager, Status
from aas_compliance_tool.state_manager import ComplianceToolStateManager, Status


def parse_cli_arguments() -> argparse.ArgumentParser:
Expand Down
6 changes: 3 additions & 3 deletions compliance_tool/aas_compliance_tool/compliance_check_aasx.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2020 the Eclipse BaSyx Authors
# Copyright (c) 2024 the Eclipse BaSyx Authors
#
# This program and the accompanying materials are made available under the terms of the MIT License, available in
# the LICENSE file of this project.
Expand All @@ -19,14 +19,14 @@

import pyecma376_2

from . import compliance_check_json, compliance_check_xml
from aas_compliance_tool import compliance_check_json, compliance_check_xml
from basyx.aas import model
from basyx.aas.adapter import aasx
from basyx.aas.adapter.xml import xml_deserialization
from basyx.aas.adapter.json import json_deserialization
from basyx.aas.examples.data import example_aas, create_example_aas_binding
from basyx.aas.examples.data._helper import AASDataChecker, DataChecker
from .state_manager import ComplianceToolStateManager, Status
from aas_compliance_tool.state_manager import ComplianceToolStateManager, Status


def check_deserialization(file_path: str, state_manager: ComplianceToolStateManager,
Expand Down
4 changes: 2 additions & 2 deletions compliance_tool/aas_compliance_tool/compliance_check_json.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2020 the Eclipse BaSyx Authors
# Copyright (c) 2024 the Eclipse BaSyx Authors
#
# This program and the accompanying materials are made available under the terms of the MIT License, available in
# the LICENSE file of this project.
Expand All @@ -20,7 +20,7 @@
from basyx.aas.adapter.json import json_deserialization
from basyx.aas.examples.data import example_aas, create_example
from basyx.aas.examples.data._helper import AASDataChecker
from .state_manager import ComplianceToolStateManager, Status
from aas_compliance_tool.state_manager import ComplianceToolStateManager, Status


JSON_SCHEMA_FILE = os.path.join(os.path.dirname(__file__), 'schemas/aasJSONSchema.json')
Expand Down
4 changes: 2 additions & 2 deletions compliance_tool/aas_compliance_tool/compliance_check_xml.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2020 the Eclipse BaSyx Authors
# Copyright (c) 2024 the Eclipse BaSyx Authors
#
# This program and the accompanying materials are made available under the terms of the MIT License, available in
# the LICENSE file of this project.
Expand All @@ -20,7 +20,7 @@
from basyx.aas.adapter.xml import xml_deserialization
from basyx.aas.examples.data import example_aas, create_example
from basyx.aas.examples.data._helper import AASDataChecker
from .state_manager import ComplianceToolStateManager, Status
from aas_compliance_tool.state_manager import ComplianceToolStateManager, Status


XML_SCHEMA_FILE = os.path.join(os.path.dirname(__file__), 'schemas/aasXMLSchema.xsd')
Expand Down
2 changes: 1 addition & 1 deletion compliance_tool/aas_compliance_tool/state_manager.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2020 the Eclipse BaSyx Authors
# Copyright (c) 2024 the Eclipse BaSyx Authors
#
# This program and the accompanying materials are made available under the terms of the MIT License, available in
# the LICENSE file of this project.
Expand Down
2 changes: 1 addition & 1 deletion compliance_tool/setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
# Copyright (c) 2019-2021 the Eclipse BaSyx Authors
# Copyright (c) 2024-2021 the Eclipse BaSyx Authors
#
# This program and the accompanying materials are made available under the terms of the MIT License, available in
# the LICENSE file of this project.
Expand Down
10 changes: 5 additions & 5 deletions compliance_tool/test/files/test_demo_full_example.json
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@
},
{
"language": "de",
"text": "Ein Beispiel-BillofMaterial-Submodel f\u00fcr eine Test-Anwendung"
"text": "Ein Beispiel-BillOfMaterial-Submodel f\u00fcr eine Test-Anwendung"
}
],
"modelType": "Submodel",
Expand Down Expand Up @@ -1309,7 +1309,7 @@
},
{
"language": "de",
"text": "Beispielswert f\u00fcr ein MulitLanguageProperty-Element"
"text": "Beispielwert f\u00fcr ein MultiLanguageProperty-Element"
}
],
"valueId": {
Expand Down Expand Up @@ -2281,7 +2281,7 @@
},
{
"language": "de",
"text": "Beispiel MulitLanguageProperty Element"
"text": "Beispiel MultiLanguageProperty Element"
}
],
"modelType": "MultiLanguageProperty",
Expand All @@ -2301,7 +2301,7 @@
},
{
"language": "de",
"text": "Beispielswert f\u00fcr ein MulitLanguageProperty-Element"
"text": "Beispielwert f\u00fcr ein MultiLanguageProperty-Element"
}
]
},
Expand Down Expand Up @@ -2825,7 +2825,7 @@
},
{
"language": "de",
"text": "Beispiel MulitLanguageProperty Element"
"text": "Beispiel MultiLanguageProperty Element"
}
],
"modelType": "MultiLanguageProperty",
Expand Down
10 changes: 5 additions & 5 deletions compliance_tool/test/files/test_demo_full_example.xml
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@
</aas:langStringTextType>
<aas:langStringTextType>
<aas:language>de</aas:language>
<aas:text>Ein Beispiel-BillofMaterial-Submodel für eine Test-Anwendung</aas:text>
<aas:text>Ein Beispiel-BillOfMaterial-Submodel für eine Test-Anwendung</aas:text>
</aas:langStringTextType>
</aas:description>
<aas:administration>
Expand Down Expand Up @@ -1424,7 +1424,7 @@
</aas:langStringTextType>
<aas:langStringTextType>
<aas:language>de</aas:language>
<aas:text>Beispielswert für ein MulitLanguageProperty-Element</aas:text>
<aas:text>Beispielwert für ein MultiLanguageProperty-Element</aas:text>
</aas:langStringTextType>
</aas:value>
<aas:valueId>
Expand Down Expand Up @@ -2109,7 +2109,7 @@
</aas:langStringTextType>
<aas:langStringTextType>
<aas:language>de</aas:language>
<aas:text>Beispiel MulitLanguageProperty Element</aas:text>
<aas:text>Beispiel MultiLanguageProperty Element</aas:text>
</aas:langStringTextType>
</aas:description>
<aas:semanticId>
Expand All @@ -2128,7 +2128,7 @@
</aas:langStringTextType>
<aas:langStringTextType>
<aas:language>de</aas:language>
<aas:text>Beispielswert für ein MulitLanguageProperty-Element</aas:text>
<aas:text>Beispielwert für ein MultiLanguageProperty-Element</aas:text>
</aas:langStringTextType>
</aas:value>
</aas:multiLanguageProperty>
Expand Down Expand Up @@ -2632,7 +2632,7 @@
</aas:langStringTextType>
<aas:langStringTextType>
<aas:language>de</aas:language>
<aas:text>Beispiel MulitLanguageProperty Element</aas:text>
<aas:text>Beispiel MultiLanguageProperty Element</aas:text>
</aas:langStringTextType>
</aas:description>
<aas:semanticId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@
},
{
"language": "de",
"text": "Ein Beispiel-BillofMaterial-Submodel f\u00fcr eine Test-Anwendung"
"text": "Ein Beispiel-BillOfMaterial-Submodel f\u00fcr eine Test-Anwendung"
}
],
"modelType": "Submodel",
Expand Down Expand Up @@ -1317,7 +1317,7 @@
},
{
"language": "de",
"text": "Beispielswert f\u00fcr ein MulitLanguageProperty-Element"
"text": "Beispielwert f\u00fcr ein MultiLanguageProperty-Element"
}
],
"valueId": {
Expand Down Expand Up @@ -2289,7 +2289,7 @@
},
{
"language": "de",
"text": "Beispiel MulitLanguageProperty Element"
"text": "Beispiel MultiLanguageProperty Element"
}
],
"modelType": "MultiLanguageProperty",
Expand All @@ -2309,7 +2309,7 @@
},
{
"language": "de",
"text": "Beispielswert f\u00fcr ein MulitLanguageProperty-Element"
"text": "Beispielwert f\u00fcr ein MultiLanguageProperty-Element"
}
]
},
Expand Down Expand Up @@ -2833,7 +2833,7 @@
},
{
"language": "de",
"text": "Beispiel MulitLanguageProperty Element"
"text": "Beispiel MultiLanguageProperty Element"
}
],
"modelType": "MultiLanguageProperty",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@
},
{
"language": "de",
"text": "Ein Beispiel-BillofMaterial-Submodel f\u00fcr eine Test-Anwendung"
"text": "Ein Beispiel-BillOfMaterial-Submodel f\u00fcr eine Test-Anwendung"
}
],
"modelType": "Submodel",
Expand Down Expand Up @@ -1309,7 +1309,7 @@
},
{
"language": "de",
"text": "Beispielswert f\u00fcr ein MulitLanguageProperty-Element"
"text": "Beispielwert f\u00fcr ein MultiLanguageProperty-Element"
}
],
"valueId": {
Expand Down Expand Up @@ -2281,7 +2281,7 @@
},
{
"language": "de",
"text": "Beispiel MulitLanguageProperty Element"
"text": "Beispiel MultiLanguageProperty Element"
}
],
"modelType": "MultiLanguageProperty",
Expand All @@ -2301,7 +2301,7 @@
},
{
"language": "de",
"text": "Beispielswert f\u00fcr ein MulitLanguageProperty-Element"
"text": "Beispielwert f\u00fcr ein MultiLanguageProperty-Element"
}
]
},
Expand Down Expand Up @@ -2825,7 +2825,7 @@
},
{
"language": "de",
"text": "Beispiel MulitLanguageProperty Element"
"text": "Beispiel MultiLanguageProperty Element"
}
],
"modelType": "MultiLanguageProperty",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@
</aas:langStringTextType>
<aas:langStringTextType>
<aas:language>de</aas:language>
<aas:text>Ein Beispiel-BillofMaterial-Submodel für eine Test-Anwendung</aas:text>
<aas:text>Ein Beispiel-BillOfMaterial-Submodel für eine Test-Anwendung</aas:text>
</aas:langStringTextType>
</aas:description>
<aas:administration>
Expand Down Expand Up @@ -1424,7 +1424,7 @@
</aas:langStringTextType>
<aas:langStringTextType>
<aas:language>de</aas:language>
<aas:text>Beispielswert für ein MulitLanguageProperty-Element</aas:text>
<aas:text>Beispielwert für ein MultiLanguageProperty-Element</aas:text>
</aas:langStringTextType>
</aas:value>
<aas:valueId>
Expand Down Expand Up @@ -2109,7 +2109,7 @@
</aas:langStringTextType>
<aas:langStringTextType>
<aas:language>de</aas:language>
<aas:text>Beispiel MulitLanguageProperty Element</aas:text>
<aas:text>Beispiel MultiLanguageProperty Element</aas:text>
</aas:langStringTextType>
</aas:description>
<aas:semanticId>
Expand All @@ -2128,7 +2128,7 @@
</aas:langStringTextType>
<aas:langStringTextType>
<aas:language>de</aas:language>
<aas:text>Beispielswert für ein MulitLanguageProperty-Element</aas:text>
<aas:text>Beispielwert für ein MultiLanguageProperty-Element</aas:text>
</aas:langStringTextType>
</aas:value>
</aas:multiLanguageProperty>
Expand Down Expand Up @@ -2632,7 +2632,7 @@
</aas:langStringTextType>
<aas:langStringTextType>
<aas:language>de</aas:language>
<aas:text>Beispiel MulitLanguageProperty Element</aas:text>
<aas:text>Beispiel MultiLanguageProperty Element</aas:text>
</aas:langStringTextType>
</aas:description>
<aas:semanticId>
Expand Down
Loading

0 comments on commit 1ca495f

Please sign in to comment.