aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6
diff options
context:
space:
mode:
Diffstat (limited to 'sources/pyside6')
-rw-r--r--sources/pyside6/tests/CMakeLists.txt4
-rw-r--r--sources/pyside6/tests/QtAsyncio/CMakeLists.txt9
-rw-r--r--sources/pyside6/tests/QtAsyncio/bug_2790.py10
-rw-r--r--sources/pyside6/tests/QtAsyncio/bug_2799.py12
-rw-r--r--sources/pyside6/tests/QtAsyncio/qasyncio_test.py9
-rw-r--r--sources/pyside6/tests/QtAsyncio/qasyncio_test_cancel_task.py9
-rw-r--r--sources/pyside6/tests/QtAsyncio/qasyncio_test_cancel_taskgroup.py10
-rw-r--r--sources/pyside6/tests/QtAsyncio/qasyncio_test_chain.py9
-rw-r--r--sources/pyside6/tests/QtAsyncio/qasyncio_test_executor.py9
-rw-r--r--sources/pyside6/tests/QtAsyncio/qasyncio_test_queues.py9
-rw-r--r--sources/pyside6/tests/QtAsyncio/qasyncio_test_threadsafe.py10
-rw-r--r--sources/pyside6/tests/QtAsyncio/qasyncio_test_time.py9
-rw-r--r--sources/pyside6/tests/QtAsyncio/qasyncio_test_uncancel.py10
-rw-r--r--sources/pyside6/tests/pysidetest/mypy_correctness_test.py3
14 files changed, 107 insertions, 15 deletions
diff --git a/sources/pyside6/tests/CMakeLists.txt b/sources/pyside6/tests/CMakeLists.txt
index 38042533d..40df2c682 100644
--- a/sources/pyside6/tests/CMakeLists.txt
+++ b/sources/pyside6/tests/CMakeLists.txt
@@ -48,6 +48,10 @@ endmacro()
if (NOT DISABLE_QtCore AND NOT DISABLE_QtGui AND NOT DISABLE_QtWidgets)
add_subdirectory(pysidetest)
endif()
+if (NOT DISABLE_QtAsyncio)
+ add_subdirectory(QtAsyncio)
+endif()
+
add_subdirectory(registry)
add_subdirectory(signals)
add_subdirectory(support)
diff --git a/sources/pyside6/tests/QtAsyncio/CMakeLists.txt b/sources/pyside6/tests/QtAsyncio/CMakeLists.txt
index 935e0d90a..221b74b64 100644
--- a/sources/pyside6/tests/QtAsyncio/CMakeLists.txt
+++ b/sources/pyside6/tests/QtAsyncio/CMakeLists.txt
@@ -1,2 +1,11 @@
+PYSIDE_TEST(bug_2790.py)
+PYSIDE_TEST(bug_2799.py)
PYSIDE_TEST(qasyncio_test.py)
+PYSIDE_TEST(qasyncio_test_cancel_task.py)
+PYSIDE_TEST(qasyncio_test_cancel_taskgroup.py)
PYSIDE_TEST(qasyncio_test_chain.py)
+PYSIDE_TEST(qasyncio_test_executor.py)
+PYSIDE_TEST(qasyncio_test_queues.py)
+PYSIDE_TEST(qasyncio_test_threadsafe.py)
+PYSIDE_TEST(qasyncio_test_time.py)
+PYSIDE_TEST(qasyncio_test_uncancel.py)
diff --git a/sources/pyside6/tests/QtAsyncio/bug_2790.py b/sources/pyside6/tests/QtAsyncio/bug_2790.py
index 9fd152b15..5bf91931e 100644
--- a/sources/pyside6/tests/QtAsyncio/bug_2790.py
+++ b/sources/pyside6/tests/QtAsyncio/bug_2790.py
@@ -4,9 +4,16 @@ from __future__ import annotations
'''Test cases for QtAsyncio'''
+import os
+import sys
import unittest
-import asyncio
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
+from init_paths import init_test_paths
+init_test_paths(False)
+
+import asyncio
import PySide6.QtAsyncio as QtAsyncio
@@ -29,6 +36,7 @@ class QAsyncioTestCaseBug2790(unittest.TestCase):
except TimeoutError:
outputs.append("Timeout")
+ @unittest.skipIf(sys.version_info < (3, 11), "requires asyncio.timeout")
def test_timeout(self):
# The Qt event loop (and thus QtAsyncio) does not guarantee that events
# will be processed in the order they were posted, so there is two
diff --git a/sources/pyside6/tests/QtAsyncio/bug_2799.py b/sources/pyside6/tests/QtAsyncio/bug_2799.py
index eb86c7d4b..c277bd5b0 100644
--- a/sources/pyside6/tests/QtAsyncio/bug_2799.py
+++ b/sources/pyside6/tests/QtAsyncio/bug_2799.py
@@ -4,10 +4,16 @@ from __future__ import annotations
"""Test cases for QtAsyncio"""
-import unittest
-import asyncio
+import os
import sys
+import unittest
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
+from init_paths import init_test_paths
+init_test_paths(False)
+
+import asyncio
import PySide6.QtAsyncio as QtAsyncio
@@ -22,7 +28,7 @@ class QAsyncioTestCaseBug2799(unittest.TestCase):
raise RuntimeError()
def test_exception_group(self):
- with self.assertRaises(ExceptionGroup):
+ with self.assertRaises(ExceptionGroup): # noqa: F821
QtAsyncio.run(self.main(), keep_running=False)
diff --git a/sources/pyside6/tests/QtAsyncio/qasyncio_test.py b/sources/pyside6/tests/QtAsyncio/qasyncio_test.py
index 80c5107ac..cf3f77113 100644
--- a/sources/pyside6/tests/QtAsyncio/qasyncio_test.py
+++ b/sources/pyside6/tests/QtAsyncio/qasyncio_test.py
@@ -4,9 +4,16 @@ from __future__ import annotations
'''Test cases for QtAsyncio'''
+import os
+import sys
import unittest
-import asyncio
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
+from init_paths import init_test_paths
+init_test_paths(False)
+
+import asyncio
from PySide6.QtAsyncio import QAsyncioEventLoopPolicy
diff --git a/sources/pyside6/tests/QtAsyncio/qasyncio_test_cancel_task.py b/sources/pyside6/tests/QtAsyncio/qasyncio_test_cancel_task.py
index c2f56d01a..ab28beb8f 100644
--- a/sources/pyside6/tests/QtAsyncio/qasyncio_test_cancel_task.py
+++ b/sources/pyside6/tests/QtAsyncio/qasyncio_test_cancel_task.py
@@ -4,9 +4,16 @@ from __future__ import annotations
'''Test cases for QtAsyncio'''
-import asyncio
+import os
+import sys
import unittest
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
+from init_paths import init_test_paths
+init_test_paths(False)
+
+import asyncio
import PySide6.QtAsyncio as QtAsyncio
diff --git a/sources/pyside6/tests/QtAsyncio/qasyncio_test_cancel_taskgroup.py b/sources/pyside6/tests/QtAsyncio/qasyncio_test_cancel_taskgroup.py
index f3724f010..178701dc2 100644
--- a/sources/pyside6/tests/QtAsyncio/qasyncio_test_cancel_taskgroup.py
+++ b/sources/pyside6/tests/QtAsyncio/qasyncio_test_cancel_taskgroup.py
@@ -4,10 +4,16 @@ from __future__ import annotations
'''Test cases for QtAsyncio'''
-import asyncio
-import unittest
+import os
import sys
+import unittest
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
+from init_paths import init_test_paths
+init_test_paths(False)
+
+import asyncio
import PySide6.QtAsyncio as QtAsyncio
diff --git a/sources/pyside6/tests/QtAsyncio/qasyncio_test_chain.py b/sources/pyside6/tests/QtAsyncio/qasyncio_test_chain.py
index a8e5bb198..8b41a133a 100644
--- a/sources/pyside6/tests/QtAsyncio/qasyncio_test_chain.py
+++ b/sources/pyside6/tests/QtAsyncio/qasyncio_test_chain.py
@@ -4,11 +4,18 @@ from __future__ import annotations
'''Test cases for QtAsyncio'''
+import os
+import sys
import unittest
+
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
+from init_paths import init_test_paths
+init_test_paths(False)
+
import asyncio
import random
import time
-
from PySide6.QtAsyncio import QAsyncioEventLoopPolicy
diff --git a/sources/pyside6/tests/QtAsyncio/qasyncio_test_executor.py b/sources/pyside6/tests/QtAsyncio/qasyncio_test_executor.py
index 641d374df..f9812a771 100644
--- a/sources/pyside6/tests/QtAsyncio/qasyncio_test_executor.py
+++ b/sources/pyside6/tests/QtAsyncio/qasyncio_test_executor.py
@@ -4,11 +4,18 @@ from __future__ import annotations
'''Test cases for QtAsyncio'''
+import os
+import sys
import unittest
-import asyncio
from concurrent.futures import ThreadPoolExecutor
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
+from init_paths import init_test_paths
+init_test_paths(False)
+
+import asyncio
from PySide6.QtCore import QThread
from PySide6.QtAsyncio import QAsyncioEventLoopPolicy
diff --git a/sources/pyside6/tests/QtAsyncio/qasyncio_test_queues.py b/sources/pyside6/tests/QtAsyncio/qasyncio_test_queues.py
index 2df39ee02..f75480d9d 100644
--- a/sources/pyside6/tests/QtAsyncio/qasyncio_test_queues.py
+++ b/sources/pyside6/tests/QtAsyncio/qasyncio_test_queues.py
@@ -4,11 +4,18 @@ from __future__ import annotations
'''Test cases for QtAsyncio'''
+import os
+import sys
import unittest
+
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
+from init_paths import init_test_paths
+init_test_paths(False)
+
import asyncio
import random
import time
-
from PySide6.QtAsyncio import QAsyncioEventLoopPolicy
diff --git a/sources/pyside6/tests/QtAsyncio/qasyncio_test_threadsafe.py b/sources/pyside6/tests/QtAsyncio/qasyncio_test_threadsafe.py
index 489354349..a3bcd0c27 100644
--- a/sources/pyside6/tests/QtAsyncio/qasyncio_test_threadsafe.py
+++ b/sources/pyside6/tests/QtAsyncio/qasyncio_test_threadsafe.py
@@ -4,14 +4,22 @@ from __future__ import annotations
'''Test cases for QtAsyncio'''
+import os
+import sys
import unittest
+
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
+from init_paths import init_test_paths
+init_test_paths(False)
+
import asyncio
import threading
import time
-
from PySide6.QtAsyncio import QAsyncioEventLoopPolicy
+@unittest.skip("Temporarily disabled: hangs indefinitely on Python < 3.11")
class QAsyncioTestCaseThreadsafe(unittest.TestCase):
def setUp(self) -> None:
diff --git a/sources/pyside6/tests/QtAsyncio/qasyncio_test_time.py b/sources/pyside6/tests/QtAsyncio/qasyncio_test_time.py
index 66f0433df..e95e457b6 100644
--- a/sources/pyside6/tests/QtAsyncio/qasyncio_test_time.py
+++ b/sources/pyside6/tests/QtAsyncio/qasyncio_test_time.py
@@ -4,10 +4,17 @@ from __future__ import annotations
'''Test cases for QtAsyncio'''
+import os
+import sys
import unittest
+
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
+from init_paths import init_test_paths
+init_test_paths(False)
+
import asyncio
import datetime
-
from PySide6.QtAsyncio import QAsyncioEventLoopPolicy
diff --git a/sources/pyside6/tests/QtAsyncio/qasyncio_test_uncancel.py b/sources/pyside6/tests/QtAsyncio/qasyncio_test_uncancel.py
index 036622845..fd75a1fc7 100644
--- a/sources/pyside6/tests/QtAsyncio/qasyncio_test_uncancel.py
+++ b/sources/pyside6/tests/QtAsyncio/qasyncio_test_uncancel.py
@@ -4,12 +4,20 @@ from __future__ import annotations
"""Test cases for QtAsyncio"""
+import os
+import sys
import unittest
-import asyncio
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
+from init_paths import init_test_paths
+init_test_paths(False)
+
+import asyncio
import PySide6.QtAsyncio as QtAsyncio
+@unittest.skipIf(sys.version_info < (3, 11), "requires Task.uncancel() (Python 3.11+)")
class QAsyncioTestCaseUncancel(unittest.TestCase):
""" https://superfastpython.com/asyncio-cancel-task-cancellation """
diff --git a/sources/pyside6/tests/pysidetest/mypy_correctness_test.py b/sources/pyside6/tests/pysidetest/mypy_correctness_test.py
index 83d80efca..9d836cfec 100644
--- a/sources/pyside6/tests/pysidetest/mypy_correctness_test.py
+++ b/sources/pyside6/tests/pysidetest/mypy_correctness_test.py
@@ -69,8 +69,9 @@ class MypyCorrectnessTest(unittest.TestCase):
def testMypy(self):
self.assertTrue(HAVE_MYPY)
insert_version = ["--python-version", "3.11"] if sys.version_info[:2] < (3, 11) else []
+ exclusion = ["--exclude", "QtAsyncio"]
cmd = ([sys.executable, "-m", "mypy", "--pretty", "--cache-dir", self.cache_dir]
- + insert_version + [self.pyside_dir])
+ + exclusion + insert_version + [self.pyside_dir])
time_pre = time.time()
ret = subprocess.run(cmd, capture_output=True)
time_post = time.time()