diff options
| -rw-r--r-- | requirements-coin.txt | 1 | ||||
| -rw-r--r-- | requirements.txt | 1 | ||||
| -rw-r--r-- | sources/pyside6/tests/pysidetest/mypy_correctness_test.py | 10 |
3 files changed, 10 insertions, 2 deletions
diff --git a/requirements-coin.txt b/requirements-coin.txt index fd898f04f..5ee2bac0d 100644 --- a/requirements-coin.txt +++ b/requirements-coin.txt @@ -10,4 +10,3 @@ importlib_metadata>=6 tomli>=2.0.1 wheel>=0.43.0 platformdirs >= 2.6.2 -mypy>=1.11.2 diff --git a/requirements.txt b/requirements.txt index 281aef062..96d8be52d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,3 +8,4 @@ patchelf==0.17.2; sys_platform == 'linux' # 1.24.4 is the last version that supports Python 3.8 numpy<1.25; python_version < '3.9' numpy==1.26.3; python_version >= '3.9' +mypy[faster-cache]>=1.13.0 diff --git a/sources/pyside6/tests/pysidetest/mypy_correctness_test.py b/sources/pyside6/tests/pysidetest/mypy_correctness_test.py index bad35a2f3..5f94f82ab 100644 --- a/sources/pyside6/tests/pysidetest/mypy_correctness_test.py +++ b/sources/pyside6/tests/pysidetest/mypy_correctness_test.py @@ -22,8 +22,13 @@ except ModuleNotFoundError: import PySide6 from PySide6 import SKIP_MYPY_TEST +qtest_env = os.environ.get("QTEST_ENVIRONMENT", "") +is_ci = qtest_env == "ci" +# When we are in COIN, we enforce mypy existence, to prevent misconfigurations. +USE_MYPY = True if is_ci else HAVE_MYPY -@unittest.skipIf(not HAVE_MYPY, "The mypy test was skipped because mypy is not installed") + +@unittest.skipIf(not USE_MYPY, "The mypy test was skipped because mypy is not installed") @unittest.skipIf(SKIP_MYPY_TEST, "The mypy test was disabled") class MypyCorrectnessTest(unittest.TestCase): @@ -32,6 +37,8 @@ class MypyCorrectnessTest(unittest.TestCase): self.build_dir = self.pyside_dir.parent.parent os.chdir(self.build_dir) self.project_dir = Path(__file__).resolve().parents[4] + # For safety about future changes, check that we are sitting above the sources dir. + self.assertTrue((self.project_dir / "sources").exists()) # Check if the project dir can be written. If so, put the mypy cache there. test_fname = self.project_dir / ".tmp test writable" try: @@ -44,6 +51,7 @@ class MypyCorrectnessTest(unittest.TestCase): self.cache_dir = ".mypy_cache" # This is the mypy default. def testMypy(self): + self.assertTrue(HAVE_MYPY) cmd = [sys.executable, "-m", "mypy", "--cache-dir", self.cache_dir, self.pyside_dir] time_pre = time.time() ret = subprocess.run(cmd, capture_output=True) |
