Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit f4890a9

Browse files
committedMar 1, 2024··
Add a test for reading pyproject.toml recursively
1 parent 5da2cc0 commit f4890a9

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed
 

‎test-data/unit/cmdline.pyproject.test

+52
Original file line numberDiff line numberDiff line change
@@ -133,3 +133,55 @@ Neither is this!
133133
description = "Factory ⸻ A code generator 🏭"
134134
\[tool.mypy]
135135
[file x.py]
136+
137+
[case testSearchRecursively]
138+
# cmd: mypy x.py
139+
[file ../pyproject.toml]
140+
\[tool.mypy]
141+
\[tool.mypy.overrides]
142+
module = "x"
143+
disallow_untyped_defs = false
144+
[file x.py]
145+
pass
146+
[out]
147+
../pyproject.toml: tool.mypy.overrides sections must be an array. Please make sure you are using double brackets like so: [[tool.mypy.overrides]]
148+
== Return code: 0
149+
150+
[case testSearchRecursivelyStopsGit]
151+
# cmd: mypy x
152+
[file .git/test]
153+
[file ../pyproject.toml]
154+
\[tool.mypy]
155+
\[tool.mypy]
156+
exclude = '''(?x)(
157+
(^|/)[^/]*skipme_\.py$
158+
|(^|/)_skipme[^/]*\.py$
159+
)'''
160+
[file x/__init__.py]
161+
i: int = 0
162+
[file x/_skipme_please.py]
163+
This isn't even syntatically valid!
164+
[file x/please_skipme_.py]
165+
Neither is this!
166+
[out]
167+
x/_skipme_please.py:1: error: unterminated string literal (detected at line 1)
168+
== Return code: 2
169+
170+
[case testSearchRecursivelyStopsHg]
171+
# cmd: mypy x
172+
[file .hg/test]
173+
[file ../pyproject.toml]
174+
\[tool.mypy]
175+
exclude = '''(?x)(
176+
(^|/)[^/]*skipme_\.py$
177+
|(^|/)_skipme[^/]*\.py$
178+
)'''
179+
[file x/__init__.py]
180+
i: int = 0
181+
[file x/_skipme_please.py]
182+
This isn't even syntatically valid!
183+
[file x/please_skipme_.py]
184+
Neither is this!
185+
[out]
186+
x/_skipme_please.py:1: error: unterminated string literal (detected at line 1)
187+
== Return code: 2

0 commit comments

Comments
 (0)
Please sign in to comment.