Skip to content

Commit

Permalink
fix import errors caused by compliance-tool
Browse files Browse the repository at this point in the history
  • Loading branch information
Frosty2500 committed Dec 14, 2024
1 parent 37f5a3e commit d683a27
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 16 deletions.
6 changes: 3 additions & 3 deletions compliance_tool/aas_compliance_tool/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@

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
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 .state_manager import ComplianceToolStateManager, Status


def parse_cli_arguments() -> argparse.ArgumentParser:
Expand Down
14 changes: 8 additions & 6 deletions compliance_tool/test/test_aas_compliance_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import tempfile

import basyx.aas.compliance_tool
import compliance_tool
from basyx.aas import model
from basyx.aas.adapter import aasx
from basyx.aas.adapter.json import read_aas_json_file
Expand All @@ -25,14 +25,16 @@

def _run_compliance_tool(*compliance_tool_args, **kwargs) -> subprocess.CompletedProcess:
"""
This function runs the compliance tool using subprocess.run() while adjusting the PYTHONPATH environment variable
and setting the stdout and stderr parameters of subprocess.run() to PIPE.
This function runs the compliance tool using subprocess.run()
and sets the stdout and stderr parameters of subprocess.run() to PIPE.
Positional arguments are passed to the compliance tool, while keyword arguments are passed to subprocess.run().
"""
env = os.environ.copy()
env['PYTHONPATH'] = "{}:{}".format(os.environ.get('PYTHONPATH', ''),
os.path.join(os.path.dirname(basyx.__file__), os.pardir))
compliance_tool_path = os.path.join(os.path.dirname(basyx.aas.compliance_tool.__file__), 'cli.py')
compliance_tool_path = os.path.join(
os.path.dirname(os.path.dirname(__file__)),
'aas_compliance_tool',
'cli.py'
)
return subprocess.run([sys.executable, compliance_tool_path] + list(compliance_tool_args), stdout=subprocess.PIPE,
stderr=subprocess.PIPE, env=env, **kwargs)

Expand Down
4 changes: 2 additions & 2 deletions compliance_tool/test/test_compliance_check_aasx.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import os
import unittest

from basyx.aas.compliance_tool import compliance_check_aasx as compliance_tool
from basyx.aas.compliance_tool.state_manager import ComplianceToolStateManager, Status
from compliance_tool.aas_compliance_tool import compliance_check_aasx as compliance_tool
from compliance_tool.aas_compliance_tool.state_manager import ComplianceToolStateManager, Status


class ComplianceToolAASXTest(unittest.TestCase):
Expand Down
4 changes: 2 additions & 2 deletions compliance_tool/test/test_compliance_check_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import os
import unittest

import basyx.aas.compliance_tool.compliance_check_json as compliance_tool
from basyx.aas.compliance_tool.state_manager import ComplianceToolStateManager, Status
from compliance_tool.aas_compliance_tool import compliance_check_json as compliance_tool
from compliance_tool.aas_compliance_tool.state_manager import ComplianceToolStateManager, Status


class ComplianceToolJsonTest(unittest.TestCase):
Expand Down
4 changes: 2 additions & 2 deletions compliance_tool/test/test_compliance_check_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import os
import unittest

import basyx.aas.compliance_tool.compliance_check_xml as compliance_tool
from basyx.aas.compliance_tool.state_manager import ComplianceToolStateManager, Status
from compliance_tool.aas_compliance_tool import compliance_check_xml as compliance_tool
from compliance_tool.aas_compliance_tool.state_manager import ComplianceToolStateManager, Status


class ComplianceToolXmlTest(unittest.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion compliance_tool/test/test_state_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import logging
import unittest

from basyx.aas.compliance_tool.state_manager import ComplianceToolStateManager, Status
from compliance_tool.aas_compliance_tool.state_manager import ComplianceToolStateManager, Status
from basyx.aas.examples.data._helper import DataChecker


Expand Down

0 comments on commit d683a27

Please sign in to comment.