diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d921d43..67706d6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,10 +9,10 @@ jobs: name: Checks runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 with: - python-version: "3.x" + python-version: "3.11" - run: sudo apt install libolm-dev - run: python -m pip install .[dev] - run: tox -e check_types diff --git a/Dockerfile b/Dockerfile index a1ee6af..41a32bc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3-bullseye +FROM python:3.11.6-bullseye WORKDIR /app COPY . /app RUN apt update && apt install -y libolm-dev && rm -rf /var/lib/apt/lists/* diff --git a/mypy.ini b/mypy.ini index a624b54..93c7ef9 100644 --- a/mypy.ini +++ b/mypy.ini @@ -1,6 +1,7 @@ [mypy] strict = true strict_optional = false +disallow_untyped_decorators = false [mypy-nio.*] ignore_missing_imports = True diff --git a/setup.cfg b/setup.cfg index 0932c49..5e76f9f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -15,9 +15,9 @@ packages = python_requires = >= 3.11 install_requires = attrs - aiohttp + aiohttp == 3.8.5 quart - matrix-nio[e2e] + matrix-nio[e2e] >= 0.22 tcms-api Pillow assertpy @@ -29,7 +29,7 @@ trafficlight = py.typed [options.extras_require] dev = # for tests - tox + tox >=3 # for type checking mypy == 0.940 # for linting diff --git a/trafficlight/http/status.py b/trafficlight/http/status.py index 7dca107..dbebfd7 100644 --- a/trafficlight/http/status.py +++ b/trafficlight/http/status.py @@ -13,9 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. import logging -from typing import List +from typing import List, Union -from quart import Blueprint, abort, render_template, request, send_file +from quart import Blueprint, Response, abort, render_template, request, send_file from trafficlight.internals.testsuite import TestSuite from trafficlight.store import ( @@ -63,7 +63,7 @@ async def as_junit(): # type: ignore @bp.route("//files/", methods=["GET"]) -async def test_file(guid: str, name: str): # type: ignore +async def test_file(guid: str, name: str) -> Response: test = get_test_case(guid) logger.info("Getting ${guid} ${name}") if name in test.files: @@ -74,7 +74,7 @@ async def test_file(guid: str, name: str): # type: ignore @bp.route("//suitestatus", methods=["GET"]) -async def testsuite_status(guid: str): # type: ignore +async def testsuite_status(guid: str) -> str: refresh = request.args.get("refresh", default=0, type=int) testsuite = get_testsuite(guid) if testsuite is not None: @@ -86,7 +86,7 @@ async def testsuite_status(guid: str): # type: ignore @bp.route("//status", methods=["GET"]) -async def testcase_status(guid: str): # type: ignore +async def testcase_status(guid: str) -> Union[str, Response]: refresh = request.args.get("refresh", default=0, type=int) logger.info("Finding test %s", guid) test = get_test_case(guid) diff --git a/trafficlight/tests/chat/__init__.py b/trafficlight/sample_tests/__init__.py similarity index 100% rename from trafficlight/tests/chat/__init__.py rename to trafficlight/sample_tests/__init__.py diff --git a/trafficlight/tests/video/__init__.py b/trafficlight/sample_tests/chat/__init__.py similarity index 100% rename from trafficlight/tests/video/__init__.py rename to trafficlight/sample_tests/chat/__init__.py diff --git a/trafficlight/tests/chat/dehydrated_device_test.py b/trafficlight/sample_tests/chat/dehydrated_device_test.py similarity index 100% rename from trafficlight/tests/chat/dehydrated_device_test.py rename to trafficlight/sample_tests/chat/dehydrated_device_test.py diff --git a/trafficlight/tests/chat/invited_user_decrypt_prejoin_messages_more_clients_testsuite.py b/trafficlight/sample_tests/chat/invited_user_decrypt_prejoin_messages_more_clients_testsuite.py similarity index 100% rename from trafficlight/tests/chat/invited_user_decrypt_prejoin_messages_more_clients_testsuite.py rename to trafficlight/sample_tests/chat/invited_user_decrypt_prejoin_messages_more_clients_testsuite.py diff --git a/trafficlight/tests/chat/invited_user_decrypt_prejoin_messages_test.py b/trafficlight/sample_tests/chat/invited_user_decrypt_prejoin_messages_test.py similarity index 100% rename from trafficlight/tests/chat/invited_user_decrypt_prejoin_messages_test.py rename to trafficlight/sample_tests/chat/invited_user_decrypt_prejoin_messages_test.py diff --git a/trafficlight/tests/chat/key_restore_marks_session_as_verified_test.py b/trafficlight/sample_tests/chat/key_restore_marks_session_as_verified_test.py similarity index 100% rename from trafficlight/tests/chat/key_restore_marks_session_as_verified_test.py rename to trafficlight/sample_tests/chat/key_restore_marks_session_as_verified_test.py diff --git a/trafficlight/tests/chat/message_decryption_after_storage_cleared_test.py b/trafficlight/sample_tests/chat/message_decryption_after_storage_cleared_test.py similarity index 100% rename from trafficlight/tests/chat/message_decryption_after_storage_cleared_test.py rename to trafficlight/sample_tests/chat/message_decryption_after_storage_cleared_test.py diff --git a/trafficlight/tests/chat/message_decryption_when_own_hs_offline_test.py b/trafficlight/sample_tests/chat/message_decryption_when_own_hs_offline_test.py similarity index 100% rename from trafficlight/tests/chat/message_decryption_when_own_hs_offline_test.py rename to trafficlight/sample_tests/chat/message_decryption_when_own_hs_offline_test.py diff --git a/trafficlight/tests/chat/message_warning_test.py b/trafficlight/sample_tests/chat/message_warning_test.py similarity index 100% rename from trafficlight/tests/chat/message_warning_test.py rename to trafficlight/sample_tests/chat/message_warning_test.py diff --git a/trafficlight/tests/chat/multiple_homeservers_test.py b/trafficlight/sample_tests/chat/multiple_homeservers_test.py similarity index 100% rename from trafficlight/tests/chat/multiple_homeservers_test.py rename to trafficlight/sample_tests/chat/multiple_homeservers_test.py diff --git a/trafficlight/tests/chat/retry_sendToDevice_test.py b/trafficlight/sample_tests/chat/retry_sendToDevice_test.py similarity index 100% rename from trafficlight/tests/chat/retry_sendToDevice_test.py rename to trafficlight/sample_tests/chat/retry_sendToDevice_test.py diff --git a/trafficlight/tests/chat/send_messages_and_demo_matrix_nio_test.py b/trafficlight/sample_tests/chat/send_messages_and_demo_matrix_nio_test.py similarity index 100% rename from trafficlight/tests/chat/send_messages_and_demo_matrix_nio_test.py rename to trafficlight/sample_tests/chat/send_messages_and_demo_matrix_nio_test.py diff --git a/trafficlight/tests/chat/test_verification_when_todevice_message_out_of_order_test.py b/trafficlight/sample_tests/chat/test_verification_when_todevice_message_out_of_order_test.py similarity index 100% rename from trafficlight/tests/chat/test_verification_when_todevice_message_out_of_order_test.py rename to trafficlight/sample_tests/chat/test_verification_when_todevice_message_out_of_order_test.py diff --git a/trafficlight/tests/chat/verify_client_multiple_device_test.py b/trafficlight/sample_tests/chat/verify_client_multiple_device_test.py similarity index 100% rename from trafficlight/tests/chat/verify_client_multiple_device_test.py rename to trafficlight/sample_tests/chat/verify_client_multiple_device_test.py diff --git a/trafficlight/tests/chat/verify_client_test.py b/trafficlight/sample_tests/chat/verify_client_test.py similarity index 100% rename from trafficlight/tests/chat/verify_client_test.py rename to trafficlight/sample_tests/chat/verify_client_test.py diff --git a/trafficlight/tests/hydrogen_actions_demo.py b/trafficlight/sample_tests/hydrogen_actions_demo.py similarity index 100% rename from trafficlight/tests/hydrogen_actions_demo.py rename to trafficlight/sample_tests/hydrogen_actions_demo.py diff --git a/trafficlight/tests/immediate_exit_sample.py b/trafficlight/sample_tests/immediate_exit_sample.py similarity index 100% rename from trafficlight/tests/immediate_exit_sample.py rename to trafficlight/sample_tests/immediate_exit_sample.py diff --git a/trafficlight/sample_tests/video/__init__.py b/trafficlight/sample_tests/video/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/trafficlight/tests/video/ec_basic_example.py b/trafficlight/sample_tests/video/ec_basic_example.py similarity index 100% rename from trafficlight/tests/video/ec_basic_example.py rename to trafficlight/sample_tests/video/ec_basic_example.py diff --git a/trafficlight/tests/video/handle_invite_base.py b/trafficlight/sample_tests/video/handle_invite_base.py similarity index 100% rename from trafficlight/tests/video/handle_invite_base.py rename to trafficlight/sample_tests/video/handle_invite_base.py diff --git a/trafficlight/tests/video/handle_invite_links_one_guest_test.py b/trafficlight/sample_tests/video/handle_invite_links_one_guest_test.py similarity index 88% rename from trafficlight/tests/video/handle_invite_links_one_guest_test.py rename to trafficlight/sample_tests/video/handle_invite_links_one_guest_test.py index 61776fa..cf75ea9 100644 --- a/trafficlight/tests/video/handle_invite_links_one_guest_test.py +++ b/trafficlight/sample_tests/video/handle_invite_links_one_guest_test.py @@ -1,7 +1,7 @@ from trafficlight.client_types import ElementCall from trafficlight.internals.client import ElementCallClient from trafficlight.internals.test import Test -from trafficlight.tests.video.handle_invite_base import InviteLinksMixin +from trafficlight.sample_tests.video.handle_invite_base import InviteLinksMixin class OneRegisteredInviteLinksTest(Test, InviteLinksMixin): diff --git a/trafficlight/tests/video/handle_invite_links_registered_test.py b/trafficlight/sample_tests/video/handle_invite_links_registered_test.py similarity index 89% rename from trafficlight/tests/video/handle_invite_links_registered_test.py rename to trafficlight/sample_tests/video/handle_invite_links_registered_test.py index a10fe40..23c865b 100644 --- a/trafficlight/tests/video/handle_invite_links_registered_test.py +++ b/trafficlight/sample_tests/video/handle_invite_links_registered_test.py @@ -1,7 +1,7 @@ from trafficlight.client_types import ElementCall from trafficlight.internals.client import ElementCallClient from trafficlight.internals.test import Test -from trafficlight.tests.video.handle_invite_base import InviteLinksMixin +from trafficlight.sample_tests.video.handle_invite_base import InviteLinksMixin class TwoRegisteredInviteLinksTest(Test, InviteLinksMixin): diff --git a/trafficlight/tests/video/handle_invite_links_two_guests_test.py b/trafficlight/sample_tests/video/handle_invite_links_two_guests_test.py similarity index 87% rename from trafficlight/tests/video/handle_invite_links_two_guests_test.py rename to trafficlight/sample_tests/video/handle_invite_links_two_guests_test.py index f575c41..4dc697d 100644 --- a/trafficlight/tests/video/handle_invite_links_two_guests_test.py +++ b/trafficlight/sample_tests/video/handle_invite_links_two_guests_test.py @@ -1,7 +1,7 @@ from trafficlight.client_types import ElementCall from trafficlight.internals.client import ElementCallClient from trafficlight.internals.test import Test -from trafficlight.tests.video.handle_invite_base import InviteLinksMixin +from trafficlight.sample_tests.video.handle_invite_base import InviteLinksMixin class TwoGuestsInviteLinksTest(Test, InviteLinksMixin): diff --git a/trafficlight/tests/video/join_call_recieve_video_test.py b/trafficlight/sample_tests/video/join_call_recieve_video_test.py similarity index 100% rename from trafficlight/tests/video/join_call_recieve_video_test.py rename to trafficlight/sample_tests/video/join_call_recieve_video_test.py diff --git a/trafficlight/tests/video/load_test_call_test.py b/trafficlight/sample_tests/video/load_test_call_test.py similarity index 99% rename from trafficlight/tests/video/load_test_call_test.py rename to trafficlight/sample_tests/video/load_test_call_test.py index 56c9eee..d35541f 100644 --- a/trafficlight/tests/video/load_test_call_test.py +++ b/trafficlight/sample_tests/video/load_test_call_test.py @@ -56,7 +56,6 @@ async def run(self, alice: ElementCallClient, bob: ElementCallClient) -> None: ) with soft_assertions(): - # Ensure we don't gain or lose members doing this. assert_that(alice_data.video_tiles).is_length(2) assert_that(bob_data.video_tiles).is_length(2) diff --git a/trafficlight/tests/video/three_user_spotlight.py b/trafficlight/sample_tests/video/three_user_spotlight.py similarity index 100% rename from trafficlight/tests/video/three_user_spotlight.py rename to trafficlight/sample_tests/video/three_user_spotlight.py diff --git a/trafficlight/tests/video/two_clients_one_terminated_rejoin_test.py b/trafficlight/sample_tests/video/two_clients_one_terminated_rejoin_test.py similarity index 100% rename from trafficlight/tests/video/two_clients_one_terminated_rejoin_test.py rename to trafficlight/sample_tests/video/two_clients_one_terminated_rejoin_test.py