Skip to content

Commit

Permalink
Add a test for reading pyproject.toml recursively
Browse files Browse the repository at this point in the history
  • Loading branch information
Felixoid committed Mar 1, 2024
1 parent 5da2cc0 commit f4890a9
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions test-data/unit/cmdline.pyproject.test
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,55 @@ Neither is this!
description = "Factory ⸻ A code generator 🏭"
\[tool.mypy]
[file x.py]

[case testSearchRecursively]
# cmd: mypy x.py
[file ../pyproject.toml]
\[tool.mypy]
\[tool.mypy.overrides]
module = "x"
disallow_untyped_defs = false
[file x.py]
pass
[out]
../pyproject.toml: tool.mypy.overrides sections must be an array. Please make sure you are using double brackets like so: [[tool.mypy.overrides]]
== Return code: 0

[case testSearchRecursivelyStopsGit]
# cmd: mypy x
[file .git/test]
[file ../pyproject.toml]
\[tool.mypy]
\[tool.mypy]
exclude = '''(?x)(
(^|/)[^/]*skipme_\.py$
|(^|/)_skipme[^/]*\.py$
)'''
[file x/__init__.py]
i: int = 0
[file x/_skipme_please.py]
This isn't even syntatically valid!
[file x/please_skipme_.py]
Neither is this!
[out]
x/_skipme_please.py:1: error: unterminated string literal (detected at line 1)
== Return code: 2

[case testSearchRecursivelyStopsHg]
# cmd: mypy x
[file .hg/test]
[file ../pyproject.toml]
\[tool.mypy]
exclude = '''(?x)(
(^|/)[^/]*skipme_\.py$
|(^|/)_skipme[^/]*\.py$
)'''
[file x/__init__.py]
i: int = 0
[file x/_skipme_please.py]
This isn't even syntatically valid!
[file x/please_skipme_.py]
Neither is this!
[out]
x/_skipme_please.py:1: error: unterminated string literal (detected at line 1)
== Return code: 2

0 comments on commit f4890a9

Please sign in to comment.