| 73 | |
| 74 | @unittest.skip("disabled for now") |
| 75 | def test_cqa_pyright(self): |
| 76 | config_path = PROJECT_ROOT / "pyproject.toml" |
| 77 | if not os.path.exists(config_path): |
| 78 | raise RuntimeError("could not locate pyproject.toml file") |
| 79 | |
| 80 | if not importlib.util.find_spec("basedpyright"): |
| 81 | raise unittest.SkipTest("basedpyright is not installed") from None |
| 82 | |
| 83 | try: |
| 84 | subprocess.run( |
| 85 | [ |
| 86 | sys.executable, |
| 87 | "-m", |
| 88 | "pyright", |
| 89 | ], |
| 90 | check=True, |
| 91 | capture_output=True, |
| 92 | cwd=PROJECT_ROOT, |
| 93 | env=os.environ |
| 94 | | { |
| 95 | # Suppress pyright-python's complaints about new |
| 96 | # pyright versions being available. |
| 97 | "PYRIGHT_PYTHON_IGNORE_WARNINGS": "1", |
| 98 | }, |
| 99 | ) |
| 100 | except subprocess.CalledProcessError as ex: |
| 101 | output = ex.stdout.decode() |
| 102 | if ex.stderr: |
| 103 | output += "\n\n" + ex.stderr.decode() |
| 104 | raise AssertionError(f"pyright validation failed:\n{output}") from None |
| 105 | |
| 106 | |
| 107 | if __name__ == "__main__": |