From d29019dd1260532289a1f557bdd57b67d4c626ae Mon Sep 17 00:00:00 2001 From: Torsten Kilias Date: Fri, 25 Aug 2023 19:50:54 +0200 Subject: [PATCH] Add generate_github_integration_tests_without_db_matrix_json session to noxfile --- .../integration_tests_without_db.yaml | 8 ++++---- noxfile.py | 18 +++++++++++++----- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/.github/workflows/integration_tests_without_db.yaml b/.github/workflows/integration_tests_without_db.yaml index 53570194..7bf03975 100644 --- a/.github/workflows/integration_tests_without_db.yaml +++ b/.github/workflows/integration_tests_without_db.yaml @@ -19,9 +19,9 @@ jobs: - id: generate_integration_tests_without_db name: "Generate list of integration tests without DB" - run: poetry run -- nox -s generate_integration_tests_without_db_matrix > "$GITHUB_OUTPUT" + run: poetry run -- nox -s generate_github_integration_tests_without_db_matrix > "$GITHUB_OUTPUT" outputs: - test_path: ${{ toJSON(steps.generate_integration_tests_without_db.outputs.matrix) }} + test-path: ${{ toJSON(steps.generate_integration_tests_without_db.outputs.matrix) }} debug: needs: prepare_matrix @@ -29,12 +29,12 @@ jobs: fail-fast: false matrix: python-version: [ 3.8 ] - test_path: ${{ fromJSON(needs.prepare_matrix.outputs.test_path) }} + test-path: ${{ fromJSON(needs.prepare_matrix.outputs.test-path) }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - run: echo "${{ matrix.test_path.name }}" + - run: echo "${{ matrix.test-path.name }}" run_test: needs: prepare_matrix diff --git a/noxfile.py b/noxfile.py index 16cb7f83..25d60d3b 100644 --- a/noxfile.py +++ b/noxfile.py @@ -39,15 +39,23 @@ def _generate_test_matrix_entry(test_file: Path): } -@nox.session(python=False) -def generate_integration_tests_without_db_matrix(session: Session): - """ - {"name": "", "path": ""} - """ +def _generate_github_integration_tests_without_db_matrix() -> str: without_db_test_directory = INTEGRATION_TEST_DIRECTORY / "without_db" test_files = without_db_test_directory.rglob("test_*.py") output = [_generate_test_matrix_entry(test_file) for test_file in test_files] json_str = json.dumps(output) + return json_str + + +@nox.session(python=False) +def generate_github_integration_tests_without_db_matrix_json(session: Session): + json_str = _generate_github_integration_tests_without_db_matrix() + print(json_str) + + +@nox.session(python=False) +def generate_github_integration_tests_without_db_matrix(session: Session): + json_str = _generate_github_integration_tests_without_db_matrix() github_output_definition = f"matrix={json_str}" print(github_output_definition)