Skip to content

Commit f42e2f2

Browse files
authored
Add test scenarios for analyze-project (#36)
* Add test project for ni-python-styleguide errors * Add mypy errors test project * Introduce a composite action to check a test project and expect errors conditionally * Add pyright-errors to test_actions * Use correct syntax for referencing analyze-project and use a 'v0' tag. * Use the PR's version of the GitHub analyze-project action * Use an explicit action sha for analyze-project * fix SHA * Add echo of inputs for debuggin * Add some more debugging echos * Change the id of the step * Refactor composite action to just verify a failure. continue-on-error apparently doesn't work on a composite action step * Add project with only nps * Add poetry.lock file. Do not continue on error for only-ni-python-styleguide * Inline verify failure check. Add a test_analyze_project_cache_hit * Add test_analyze_project_cache_hit * Change name to (cache hit). Exclude .github from repo_root nps analysis
1 parent 12f988e commit f42e2f2

File tree

26 files changed

+2592
-4
lines changed

26 files changed

+2592
-4
lines changed

.github/test_projects/minimal/pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[project]
2-
name = "test-project"
2+
name = "minimal"
33
version = "0.1.0"
4-
description = ""
4+
description = "Tests actions/analyze-project with a minimal project that has no errors"
55
authors = [
66
{name = "Joel Dixon",email = "[email protected]"}
77
]

.github/test_projects/mypy-errors/README.md

Whitespace-only changes.

.github/test_projects/mypy-errors/poetry.lock

Lines changed: 613 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
[project]
2+
name = "mypy-errors"
3+
version = "0.1.0"
4+
description = "Tests actions/analyze-project with a project that has mypy errors"
5+
authors = [
6+
{name = "Joel Dixon",email = "[email protected]"}
7+
]
8+
readme = "README.md"
9+
requires-python = ">=3.9,<4.0"
10+
dynamic = ["dependencies"]
11+
12+
[tool.poetry]
13+
packages = [{include = "test_project", from = "src"}]
14+
15+
[tool.poetry.group.lint.dependencies]
16+
ni-python-styleguide = ">=0.4.1"
17+
mypy = ">=1.0"
18+
pyright = { version = ">=1.1.400", extras = ["nodejs"] }
19+
20+
[tool.mypy]
21+
mypy_path = "."
22+
files = "."
23+
namespace_packages = true
24+
strict = true
25+
explicit_package_bases = true
26+
27+
[tool.pyright]
28+
include = ["src/", "tests/"]
29+
30+
[build-system]
31+
requires = ["poetry-core>=2.0.0,<3.0.0"]
32+
build-backend = "poetry.core.masonry.api"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""Docstring required."""
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
"""Required docstring."""
2+
3+
4+
def foo(x: int, y: int): # mypy error: Function is missing a return type annotation
5+
"""Required docstring."""
6+
print("Hello, world!")
7+
return x + y
8+
9+
10+
foo(1, 2)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""Module docstring."""

.github/test_projects/ni-python-styleguide-errors/README.md

Whitespace-only changes.

.github/test_projects/ni-python-styleguide-errors/poetry.lock

Lines changed: 613 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
[project]
2+
name = "ni-python-styleguide-errors"
3+
version = "0.1.0"
4+
description = "Tests actions/analyze-project with a project that has ni-python-styleguide errors"
5+
authors = [
6+
{name = "Joel Dixon",email = "[email protected]"}
7+
]
8+
readme = "README.md"
9+
requires-python = ">=3.9,<4.0"
10+
dynamic = ["dependencies"]
11+
12+
[tool.poetry]
13+
packages = [{include = "test_project", from = "src"}]
14+
15+
[tool.poetry.group.lint.dependencies]
16+
ni-python-styleguide = ">=0.4.1"
17+
mypy = ">=1.0"
18+
pyright = { version = ">=1.1.400", extras = ["nodejs"] }
19+
20+
[tool.mypy]
21+
mypy_path = "."
22+
files = "."
23+
namespace_packages = true
24+
strict = true
25+
explicit_package_bases = true
26+
27+
[tool.pyright]
28+
include = ["src/", "tests/"]
29+
30+
[build-system]
31+
requires = ["poetry-core>=2.0.0,<3.0.0"]
32+
build-backend = "poetry.core.masonry.api"

0 commit comments

Comments
 (0)