File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed
Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -103,7 +103,9 @@ description = "Run {{ type_checker }}"
103103commands = [
104104 [
105105 "{{ type_checker }}",
106- "src",
106+ {% if type_checker =="pyright" %} "--pythonpath",
107+ ".venv/bin/python",
108+ {% endif %} "src",
107109 "tests",
108110 { replace = "posargs", default = [
109111 ], extend = true },
Original file line number Diff line number Diff line change @@ -256,6 +256,27 @@ def test_pyright_works_in_standard_typing_mode(tmp_path: Path):
256256 run (f".venv/bin/pyright { tmp_path } " )
257257
258258
259+ def test_pyright_works_with_external_deps (tmp_path : Path ):
260+ copy_project (tmp_path )
261+ # Add an external dependency
262+ pyproject_toml = tmp_path / "pyproject.toml"
263+ text = pyproject_toml .read_text ().replace (
264+ "dependencies = []" , 'dependencies = ["numpy"]'
265+ )
266+ pyproject_toml .write_text (text )
267+ # And some code that uses it
268+ src_file = tmp_path / "src" / "python_copier_template_example" / "example.py"
269+ src_file .write_text ("""
270+ import numpy as np
271+
272+ def is_big(arr: np.ndarray) -> bool:
273+ return arr.size > 0
274+ """ )
275+ # Ensure pyright is still happy
276+ run = make_venv (tmp_path )
277+ run (".venv/bin/tox -e type-checking" )
278+
279+
259280def test_ignores_mypy_strict_mode (tmp_path : Path ):
260281 copy_project (tmp_path , type_checker = "mypy" , strict_typing = True )
261282 pyproject_toml = tmp_path / "pyproject.toml"
You can’t perform that action at this time.
0 commit comments