forked from eclipse-basyx/basyx-python-sdk
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove binary files from test files for compliance tool (eclipse-basy…
…x#143) * Remove binary files from test files As binary files are not appropriate for git, we decided instead to create folders with the exact structure like in .aasx files and zip these folder when initializing a ComplianceToolAASXTest. * Add setUpClass() and tearDownClass(). Instead init() use setUpClass() to generate AASX files with zipped dirs and delete these AASX files after tests are finished. * Remove test_empty.aasx binary It will be generated in ComplianceToolAASXTest.setUpClass() * Remove ComplianceToolAASXTest.tearDownClass() As other tests also need AASX files, we cannot remove AASX files after all Tests in ComplianceToolAASXTest are run. That is why tearDownClass() was removed * Move generation of AASX files to __init__.py As other tests also need AASX files, we cannot generate AASX files in ComplianceToolAASXTest, because other tests can be run before or without tests from ComplianceToolAASXTest.
- Loading branch information
Showing
34 changed files
with
9,423 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import os | ||
import zipfile | ||
|
||
AASX_FILES = ("test_demo_full_example_json_aasx", | ||
"test_demo_full_example_xml_aasx", | ||
"test_demo_full_example_xml_wrong_attribute_aasx", | ||
"test_empty_aasx") | ||
|
||
|
||
def _zip_directory(directory_path, zip_file_path): | ||
"""Zip a directory recursively.""" | ||
with zipfile.ZipFile(zip_file_path, 'w', zipfile.ZIP_DEFLATED) as zipf: | ||
for root, _, files in os.walk(directory_path): | ||
for file in files: | ||
file_path = os.path.join(root, file) | ||
arcname = os.path.relpath(file_path, directory_path) | ||
zipf.write(file_path, arcname=arcname) | ||
|
||
|
||
def generate_aasx_files(): | ||
"""Zip dirs and create test AASX files.""" | ||
script_dir = os.path.dirname(__file__) | ||
for i in AASX_FILES: | ||
_zip_directory(os.path.join(script_dir, "files", i), | ||
os.path.join(script_dir, "files", i.rstrip("_aasx") + ".aasx")) | ||
|
||
|
||
generate_aasx_files() |
Binary file not shown.
Binary file added
BIN
+7.99 KB
test/compliance_tool/files/test_demo_full_example_json_aasx/TestFile.pdf
Binary file not shown.
2 changes: 2 additions & 0 deletions
2
test/compliance_tool/files/test_demo_full_example_json_aasx/[Content_Types].xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<?xml version='1.0' encoding='UTF-8'?> | ||
<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Override PartName="/aasx/aasx-origin" ContentType="text/plain"></Override><Override PartName="/aasx/data.json" ContentType="application/json"></Override><Override PartName="/TestFile.pdf" ContentType="application/pdf"></Override><Override PartName="/aasx/_rels/data.json.rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"></Override><Override PartName="/docProps/core.xml" ContentType="application/xml"></Override><Override PartName="/aasx/_rels/aasx-origin.rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"></Override><Override PartName="/_rels/.rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"></Override></Types> |
2 changes: 2 additions & 0 deletions
2
test/compliance_tool/files/test_demo_full_example_json_aasx/_rels/.rels
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<?xml version='1.0' encoding='UTF-8'?> | ||
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Target="/aasx/aasx-origin" Id="r1" Type="http://admin-shell.io/aasx/relationships/aasx-origin" TargetMode="Internal"></Relationship><Relationship Target="/docProps/core.xml" Id="r2" Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" TargetMode="Internal"></Relationship></Relationships> |
2 changes: 2 additions & 0 deletions
2
test/compliance_tool/files/test_demo_full_example_json_aasx/aasx/_rels/aasx-origin.rels
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<?xml version='1.0' encoding='UTF-8'?> | ||
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Target="/aasx/data.json" Id="r0" Type="http://admin-shell.io/aasx/relationships/aas-spec" TargetMode="Internal"></Relationship></Relationships> |
2 changes: 2 additions & 0 deletions
2
test/compliance_tool/files/test_demo_full_example_json_aasx/aasx/_rels/data.json.rels
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<?xml version='1.0' encoding='UTF-8'?> | ||
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Target="/testfile.pdf" Id="r0" Type="http://admin-shell.io/aasx/relationships/aas-suppl" TargetMode="Internal"></Relationship></Relationships> |
Empty file.
Oops, something went wrong.