Allow explicit relative path in requirements file.

This commit is contained in:
Patrick Lehmann
2025-12-14 16:25:54 +01:00
parent 92a168c8c8
commit 323fa17773
5 changed files with 17 additions and 13 deletions

View File

@@ -237,7 +237,6 @@ jobs:
with: with:
jobs: ${{ needs.UnitTestingParams.outputs.python_jobs }} jobs: ${{ needs.UnitTestingParams.outputs.python_jobs }}
# TODO: shouldn't this be configured by a parameter? Same as directories # TODO: shouldn't this be configured by a parameter? Same as directories
requirements: "-r tests/unit/requirements.txt"
pacboy: "gcc:p" pacboy: "gcc:p"
unittest_report_xml: ${{ needs.ConfigParams.outputs.unittest_report_xml }} unittest_report_xml: ${{ needs.ConfigParams.outputs.unittest_report_xml }}
coverage_report_xml: ${{ needs.ConfigParams.outputs.coverage_report_xml }} coverage_report_xml: ${{ needs.ConfigParams.outputs.coverage_report_xml }}

View File

@@ -47,7 +47,7 @@ on:
requirements: requirements:
description: 'Python dependencies to be installed through pip.' description: 'Python dependencies to be installed through pip.'
required: false required: false
default: '-r tests/requirements.txt' default: '-r ./requirements.txt'
type: string type: string
mingw_requirements: mingw_requirements:
description: 'Override Python dependencies to be installed through pip on MSYS2 (MINGW64) only.' description: 'Override Python dependencies to be installed through pip on MSYS2 (MINGW64) only.'
@@ -82,7 +82,7 @@ on:
root_directory: root_directory:
description: 'Working directory for running tests.' description: 'Working directory for running tests.'
required: false required: false
default: '' default: '.'
type: string type: string
tests_directory: tests_directory:
description: 'Path to the directory containing tests (relative from root_directory).' description: 'Path to the directory containing tests (relative from root_directory).'
@@ -234,7 +234,12 @@ jobs:
requirements = "${{ inputs.requirements }}" requirements = "${{ inputs.requirements }}"
if requirements.startswith("-r"): if requirements.startswith("-r"):
requirementsFile = Path(requirements[2:].lstrip()) requirements = requirements[2:].lstrip()
if requirements.startswith("./"):
requirementsFile = Path("${{ inputs.root_directory || '.' }}") / Path("${{ inputs.tests_directory || '.' }}") / Path("${{ inputs.unittest_directory || '.' }}") / Path(requirements[2:])
else:
requirementsFile = Path(requirements)
try: try:
dependencies = loadRequirementsFile(requirementsFile) dependencies = loadRequirementsFile(requirementsFile)
except FileNotFoundError as ex: except FileNotFoundError as ex:

View File

@@ -11,9 +11,9 @@ docutils_stubs ~= 0.0.22
sphinx_rtd_theme ~= 3.0 sphinx_rtd_theme ~= 3.0
# Sphinx Extenstions # Sphinx Extenstions
sphinxcontrib-mermaid ~= 1.0 sphinxcontrib-mermaid ~= 1.2
autoapi >= 2.0.1 autoapi >= 2.0.1
sphinx_design ~= 0.6 sphinx_design ~= 0.6
sphinx-copybutton >= 0.5 sphinx-copybutton >= 0.5
sphinx_autodoc_typehints ~= 3.5 sphinx_autodoc_typehints ~= 3.6
sphinx_reports ~= 0.9 sphinx_reports ~= 0.9

View File

@@ -1,12 +1,5 @@
-r ../requirements.txt -r ../requirements.txt
# Coverage collection
Coverage ~= 7.11
# Test Runner
pytest ~= 9.0
pytest-cov ~= 7.0
# Static Type Checking # Static Type Checking
mypy[reports] ~= 1.18 mypy[reports] ~= 1.18
typing_extensions ~= 4.15 typing_extensions ~= 4.15

View File

@@ -1 +1,8 @@
-r ../requirements.txt -r ../requirements.txt
# Coverage collection
Coverage ~= 7.13
# Test Runner
pytest ~= 9.0
pytest-cov ~= 7.0