admin-shell-io / aas-test-engines

Official test tooling for the Asset Administration Shell
https://certification.admin-shell-io.com
Apache License 2.0
5 stars 2 forks source link

Bug: Python Exception at API Tests #17

Closed sebbader-sap closed 1 month ago

sebbader-sap commented 1 month ago

Minimal example:

File at sba_tests/test_my_own_server.py (following https://github.com/admin-shell-io/aas-test-engines/blob/652f80f7849feaa1164bec834cd20669673133d1/README.md?plain=1#L139):

from aas_test_engines import api

tests = api.generate_tests('3.0', ['Asset Administration Shell API'])
api.execute_tests(tests, "http://example.org")

Stack Trace:

python3 sba_tests/test_my_own_server.py:

Traceback (most recent call last):
  File "/Users/sba/Documents/2_git/aas-test-engines/sba_tests/test_my_own_server.py", line 3, in <module>
    tests = api.generate_tests('3.0', ['Asset Administration Shell API'])
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/aas_test_engines/api.py", line 58, in generate_tests
    conf = generate.generate(spec.api, suites)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/aas_test_engines/_api/generate.py", line 343, in generate
    if op.tags & tag_filter:
       ~~~~~~~~^~~~~~~~~~~~
TypeError: unsupported operand type(s) for &: 'set' and 'list'
sebbader-sap commented 1 month ago

Is this caused by my Python version?

otto-ifak commented 1 month ago

This is actually not a bug but wrong in the README. I have corrected this:

from aas_test_engines import api

tests = api.generate_tests(suites=set(['Asset Administration Shell API']))

conf = api.run.ExecConf(
    server = "http://localhost",
)

for result in api.execute_tests(tests, conf):
    result.dump()