Skip to content

Commit d91c115

Browse files
Write a failing test for strict mode
Write a failing test to prove that pyright's strict mode currently fails with a new project made from the template
1 parent cbc04ca commit d91c115

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/test_example.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,3 +149,17 @@ def __init__(self):
149149
stream.write(code)
150150
with pytest.raises(AssertionError, match="SLF001 Private member accessed: `_bar`"):
151151
run("ruff check")
152+
153+
154+
def test_works_in_pyright_strict_mode(tmp_path: Path):
155+
copy_project(tmp_path)
156+
pyproject_toml = tmp_path / "pyproject.toml"
157+
158+
# Enable strict mode
159+
run_pipe(
160+
f'sed -i \'/\\[tool.pyright\\]/a\\strict = ["src", "tests"]\' {pyproject_toml}'
161+
)
162+
163+
# Ensure pyright is still happy
164+
run = make_venv(tmp_path)
165+
run(f"./venv/bin/pyright {tmp_path}")

0 commit comments

Comments
 (0)