Skip to content

Commit 58c8e9a

Browse files
committed
Make typing tests importable to have a namespace
1 parent 1dcdab4 commit 58c8e9a

8 files changed

Lines changed: 14 additions & 12 deletions

File tree

‎.github/PULL_REQUEST_TEMPLATE.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ You may check boxes that don't apply to your pull request to indicate that there
2020
- Consider granting [push permissions to the PR branch](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork), so maintainers can fix minor issues themselves without pestering you.
2121
- [ ] There's **tests** for all new and changed code.
2222
- [ ] Changes or additions to public APIs are reflected in our type stubs (files ending in ``.pyi``).
23-
- [ ] ...and used in the stub test file `typing-examples/baseline.py` or, if necessary, `typing-examples/mypy.py`.
23+
- [ ] ...and used in the stub test file `typing_tests/baseline.py` or, if necessary, `typing_tests/mypy.py`.
2424
- [ ] If they've been added to `attr/__init__.pyi`, they've *also* been re-imported in `attrs/__init__.pyi`.
2525
- [ ] The **documentation** has been updated.
2626
- [ ] New functions/classes have to be added to `docs/api.rst` by hand.

‎pyproject.toml‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,7 @@ ignore = [
283283
"FA100",
284284
"UP045", # need old-school type annotations for some asserts
285285
]
286-
"typing-examples/*" = [
287-
"INP001", # not for imports
286+
"typing_tests/*" = [
288287
"E741", # ambiguous variable names don't matter in type checks
289288
"B018", # useless expressions aren't useless in type checks
290289
"B015", # pointless comparison in type checks aren't pointless
@@ -329,15 +328,15 @@ showcontent = true
329328
pretty = true
330329
disallow_untyped_defs = true
331330
check_untyped_defs = true
332-
exclude = ["typing-examples/pyrefly.py"]
331+
exclude = ["typing_tests/pyrefly.py"]
333332

334333

335334
[tool.pyright]
336-
include = ["typing-examples/baseline.py"]
335+
include = ["typing_tests/baseline.py"]
337336

338337

339338
[tool.pyrefly]
340-
project-includes = ["typing-examples"]
339+
project-includes = ["typing_tests"]
341340

342341

343342
[[tool.ty.overrides]]
@@ -350,6 +349,6 @@ include = [
350349
"docs",
351350
"src",
352351
"tests",
353-
"typing-examples/mypy.py",
354-
"typing-examples/pyrefly.py"
352+
"typing_tests/mypy.py",
353+
"typing_tests/pyrefly.py"
355354
]

‎tox.ini‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ dependency_groups =
3030
commands =
3131
tests: pytest {posargs:-n auto}
3232
mypy: pytest -k test_mypy
33-
mypy: mypy typing-examples
33+
mypy: mypy typing_tests
3434
mypy: mypy src/attrs/__init__.pyi src/attr/__init__.pyi src/attr/_typing_compat.pyi src/attr/_version_info.pyi src/attr/converters.pyi src/attr/exceptions.pyi src/attr/filters.pyi src/attr/setters.pyi src/attr/validators.pyi
3535

3636
[testenv:pypy3.11-tests]
@@ -125,12 +125,12 @@ commands =
125125
[testenv:typing-pyright]
126126
dependency_groups = pyright
127127
commands =
128-
pyright typing-examples/baseline.py
128+
pyright
129129
pytest tests/test_pyright.py -vv
130130

131131
[testenv:typing-ty]
132132
dependency_groups = ty
133-
commands = ty check typing-examples/baseline.py
133+
commands = ty check typing_tests/baseline.py
134134

135135
[testenv:typing-pyrefly]
136136
dependency_groups = pyrefly
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
# Typing examples
1+
# Type hint tests
22

33
The files in this directory are **not** meant to be executed.
44

55
They are type-checked using various type checkers to ensure our type stubs are correct.
66

7+
The directory is an importable package so its modules don't shadow real ones.
8+
79
See the environments starting with `typing-` in [`tox.ini`](../tox.ini).

‎typing_tests/__init__.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# SPDX-License-Identifier: MIT

0 commit comments

Comments
 (0)