Skip to content

Commit b0e22b9

Browse files
committed
Add test project for extras and dependency groups
1 parent d8bba9f commit b0e22b9

File tree

6 files changed

+865
-0
lines changed

6 files changed

+865
-0
lines changed

.github/test_projects/extras-and-dependency-groups/README.md

Whitespace-only changes.

.github/test_projects/extras-and-dependency-groups/poetry.lock

Lines changed: 778 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
[tool.poetry]
2+
name = "extras-and-dependency-groups"
3+
version = "0.1.0"
4+
description = "Tests actions/analyze-project with a project that has extras and dependency groups"
5+
authors = ["Joel Dixon <[email protected]>"]
6+
readme = "README.md"
7+
packages = [{include = "test_project", from = "src"}]
8+
9+
[tool.poetry.dependencies]
10+
ni-python-styleguide = ">=0.4.7"
11+
python = "^3.9"
12+
# Using a simple, publicly available package instead
13+
requests = "^2.28.0"
14+
15+
[tool.poetry.extras]
16+
# Small utility packages for testing extras
17+
colors = ["colorama"]
18+
serialization = ["tomli"]
19+
20+
[tool.poetry.group.dev.dependencies]
21+
# Small packages for testing dependency groups
22+
pytest = "^7.0.0"
23+
24+
[tool.poetry.group.docs.dependencies]
25+
# Small documentation-related packages
26+
markdown = "^3.4.0"
27+
28+
[tool.poetry.group.utils.dependencies]
29+
# Small utility packages
30+
click = "^8.0.0"
31+
32+
[build-system]
33+
requires = ["poetry-core>=2.0.0,<3.0.0"]
34+
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: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""Module docstring."""

.github/workflows/test_actions.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,57 @@ jobs:
269269
uses: ./analyze-project
270270
with:
271271
project-directory: ${{ github.workspace }}/.github/test_projects/only-ni-python-styleguide
272+
- name: Analyze extras-and-dependency-groups project
273+
uses: ./analyze-project
274+
with:
275+
project-directory: ${{ github.workspace }}/.github/test_projects/extras-and-dependency-groups
276+
extras: "colors serialization"
277+
dependency-groups: "dev,docs,utils"
278+
- name: Check for expected dependencies
279+
run: |
280+
echo "Checking for expected packages from extras and dependency groups..."
281+
pip_list=$(poetry run pip list)
282+
echo "Installed packages:"
283+
echo "$pip_list"
284+
285+
# Check for base dependencies
286+
if ! echo "$pip_list" | grep -i "ni-python-styleguide"; then
287+
echo "::error title=Test Failure::ni-python-styleguide not found in pip list"
288+
exit 1
289+
fi
290+
if ! echo "$pip_list" | grep -i "requests"; then
291+
echo "::error title=Test Failure::requests not found in pip list"
292+
exit 1
293+
fi
294+
295+
# Check for extras packages
296+
if ! echo "$pip_list" | grep -i "colorama"; then
297+
echo "::error title=Test Failure::colorama (from colors extra) not found in pip list"
298+
exit 1
299+
fi
300+
if ! echo "$pip_list" | grep -i "tomli"; then
301+
echo "::error title=Test Failure::tomli (from serialization extra) not found in pip list"
302+
exit 1
303+
fi
304+
305+
# Check for dependency group packages
306+
if ! echo "$pip_list" | grep -i "pytest"; then
307+
echo "::error title=Test Failure::pytest (from dev group) not found in pip list"
308+
exit 1
309+
fi
310+
if ! echo "$pip_list" | grep -i "markdown"; then
311+
echo "::error title=Test Failure::markdown (from docs group) not found in pip list"
312+
exit 1
313+
fi
314+
if ! echo "$pip_list" | grep -i "click"; then
315+
echo "::error title=Test Failure::click (from utils group) not found in pip list"
316+
exit 1
317+
fi
318+
319+
echo "✅ All expected packages found!"
320+
working-directory: ${{ github.workspace }}/.github/test_projects/extras-and-dependency-groups
321+
shell: bash
322+
272323

273324
test_analyze_project_cache_hit:
274325
name: Test analyze-project (cache hit)

0 commit comments

Comments
 (0)