I installed up-python and run the tests. Many do successfully pass, but one fails (which stops the tests process). I attach the log below.
It seems that for some reason, UCloudEvent.priority is an int , while UAttribute.priority is a str, and so when one is assigned to the other in ucloudevent.py:599 (called from test_from_message_with_valid_message() ), it fails.
Note that I strictly followed the installation instructions, and run the script to install up-python as a python package.
Traceback (most recent call last):
File "/home/frank/projects/up-python/tests/test_cloudevent/test_datamodel/test_ucloudevent.py", line 344, in test_from_message_with_valid_message
u_message = UCloudEvent.to_message(cloud_event)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/frank/projects/up-python/uprotocol/cloudevent/factory/ucloudevent.py", line 599, in to_message
attributes.priority = priority
^^^^^^^^^^^^^^^^^^^
TypeError: 'UPRIORITY_CS2' has type str, but expected one of: int
Traceback (most recent call last):
File "/home/frank/projects/up-python/tests/test_cloudevent/test_datamodel/test_ucloudevent.py", line 387, in test_to_from_message_from_request_cloudevent
result = UCloudEvent.to_message(cloud_event)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/frank/projects/up-python/uprotocol/cloudevent/factory/ucloudevent.py", line 599, in to_message
attributes.priority = priority
^^^^^^^^^^^^^^^^^^^
TypeError: 'UPRIORITY_CS2' has type str, but expected one of: int
Traceback (most recent call last):
File "/home/frank/projects/up-python/tests/test_cloudevent/test_datamodel/test_ucloudevent.py", line 510, in test_to_from_message_from_ucp_cloudevent
result = UCloudEvent.to_message(cloud_event)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/frank/projects/up-python/uprotocol/cloudevent/factory/ucloudevent.py", line 599, in to_message
attributes.priority = priority
^^^^^^^^^^^^^^^^^^^
TypeError: 'UPRIORITY_CS4' has type str, but expected one of: int
Traceback (most recent call last):
File "/home/frank/projects/up-python/tests/test_cloudevent/test_datamodel/test_ucloudevent.py", line 327, in test_to_message_with_valid_event
u_message = UCloudEvent.to_message(cloud_event)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/frank/projects/up-python/uprotocol/cloudevent/factory/ucloudevent.py", line 599, in to_message
attributes.priority = priority
^^^^^^^^^^^^^^^^^^^
TypeError: 'UPRIORITY_CS2' has type str, but expected one of: int
@frankghe , All the test cases are passing in the GitHub workflow. This issue might be due to differences in Python versions. Please let me know your python version so that I can fix and test it.
Hi,
I installed up-python and run the tests. Many do successfully pass, but one fails (which stops the tests process). I attach the log below.
It seems that for some reason, UCloudEvent.priority is an int , while UAttribute.priority is a str, and so when one is assigned to the other in ucloudevent.py:599 (called from test_from_message_with_valid_message() ), it fails.
Note that I strictly followed the installation instructions, and run the script to install up-python as a python package.
frank
(base) frank@ILHERWNCS50277R:~/projects/up-python$ python -m coverage run --source tests/ -m unittest discover .................................E.E.E.E..................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
ERROR: test_from_message_with_valid_message (tests.test_cloudevent.test_datamodel.test_ucloudevent.TestUCloudEvent.test_from_message_with_valid_message)
Traceback (most recent call last): File "/home/frank/projects/up-python/tests/test_cloudevent/test_datamodel/test_ucloudevent.py", line 344, in test_from_message_with_valid_message u_message = UCloudEvent.to_message(cloud_event) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/frank/projects/up-python/uprotocol/cloudevent/factory/ucloudevent.py", line 599, in to_message attributes.priority = priority ^^^^^^^^^^^^^^^^^^^ TypeError: 'UPRIORITY_CS2' has type str, but expected one of: int
====================================================================== ERROR: test_to_from_message_from_request_cloudevent (tests.test_cloudevent.test_datamodel.test_ucloudevent.TestUCloudEvent.test_to_from_message_from_request_cloudevent)
Traceback (most recent call last): File "/home/frank/projects/up-python/tests/test_cloudevent/test_datamodel/test_ucloudevent.py", line 387, in test_to_from_message_from_request_cloudevent result = UCloudEvent.to_message(cloud_event) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/frank/projects/up-python/uprotocol/cloudevent/factory/ucloudevent.py", line 599, in to_message attributes.priority = priority ^^^^^^^^^^^^^^^^^^^ TypeError: 'UPRIORITY_CS2' has type str, but expected one of: int
====================================================================== ERROR: test_to_from_message_from_ucp_cloudevent (tests.test_cloudevent.test_datamodel.test_ucloudevent.TestUCloudEvent.test_to_from_message_from_ucp_cloudevent)
Traceback (most recent call last): File "/home/frank/projects/up-python/tests/test_cloudevent/test_datamodel/test_ucloudevent.py", line 510, in test_to_from_message_from_ucp_cloudevent result = UCloudEvent.to_message(cloud_event) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/frank/projects/up-python/uprotocol/cloudevent/factory/ucloudevent.py", line 599, in to_message attributes.priority = priority ^^^^^^^^^^^^^^^^^^^ TypeError: 'UPRIORITY_CS4' has type str, but expected one of: int
====================================================================== ERROR: test_to_message_with_valid_event (tests.test_cloudevent.test_datamodel.test_ucloudevent.TestUCloudEvent.test_to_message_with_valid_event)
Traceback (most recent call last): File "/home/frank/projects/up-python/tests/test_cloudevent/test_datamodel/test_ucloudevent.py", line 327, in test_to_message_with_valid_event u_message = UCloudEvent.to_message(cloud_event) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/frank/projects/up-python/uprotocol/cloudevent/factory/ucloudevent.py", line 599, in to_message attributes.priority = priority ^^^^^^^^^^^^^^^^^^^ TypeError: 'UPRIORITY_CS2' has type str, but expected one of: int
Ran 538 tests in 9.592s
FAILED (errors=4)