From 4d2cd34b944dfdce03adc71a6909422d1023bd97 Mon Sep 17 00:00:00 2001 From: sommersoft Date: Sun, 27 Mar 2022 09:01:05 -0500 Subject: [PATCH] add pytest-order --- .github/workflows/downstream_testing.yml | 8 ++++ .../downstream_testing/action_schemas.json | 16 +++++++ .../downstream_testing/downstream_runner.py | 47 +++++++++++++------ 3 files changed, 56 insertions(+), 15 deletions(-) diff --git a/.github/workflows/downstream_testing.yml b/.github/workflows/downstream_testing.yml index 2508ae300..4e5ec535e 100644 --- a/.github/workflows/downstream_testing.yml +++ b/.github/workflows/downstream_testing.yml @@ -52,6 +52,14 @@ jobs: workflow_name: "tests.yml" matrix_exclude: "" + - name: "pytest-order" + repo: "pytest-dev/pytest-order" + docker_profile: "nodb" + jobs: "test" + workflow_name: "pythontests.yml" + matrix_exclude: | + 3.6 + steps: - uses: actions/checkout@v2 with: diff --git a/testing/downstream_testing/action_schemas.json b/testing/downstream_testing/action_schemas.json index a0954d11f..96972fb40 100644 --- a/testing/downstream_testing/action_schemas.json +++ b/testing/downstream_testing/action_schemas.json @@ -30,5 +30,21 @@ } }, "python_version": "python" + }, + "pytest-order": { + "matrix": [ + "matrix", + "python-version" + ], + "tox_cmd_build": { + "base": "", + "prefix": "", + "sub": + { + "pattern": "(\\d|py\\d)\\.*(\\d+)", + "replace": "py\\1\\2" + } + }, + "python_version": "python-version" } } \ No newline at end of file diff --git a/testing/downstream_testing/downstream_runner.py b/testing/downstream_testing/downstream_runner.py index ee1129679..72e750189 100644 --- a/testing/downstream_testing/downstream_runner.py +++ b/testing/downstream_testing/downstream_runner.py @@ -162,26 +162,43 @@ class DownstreamRunner: parsed_matrix = yaml_tree for key in self.matrix_schema["matrix"]: parsed_matrix = parsed_matrix[key] - #logger.debug("%s", parsed_matrix) + + logger.debug("parsed_matrix: %s", parsed_matrix) if parsed_matrix != yaml_tree: tox_base = self.matrix_schema["tox_cmd_build"]["base"] tox_prefix = self.matrix_schema["tox_cmd_build"]["prefix"] skip_matrices = [] - for item in parsed_matrix: - if (not item[tox_base].startswith(tox_prefix) or - item[tox_base] in self.matrix_exclude - ): - skip_matrices.append(item) - continue - item["tox_cmd"] = re.sub( - self.matrix_schema["tox_cmd_build"]["sub"]["pattern"], - self.matrix_schema["tox_cmd_build"]["sub"]["replace"], - item[tox_base] - ) - #logger.debug("re.sub: %s", item[tox_base]) - for matrice in skip_matrices: - parsed_matrix.remove(matrice) + if isinstance(parsed_matrix, dict): + for item in parsed_matrix: + if (not item[tox_base].startswith(tox_prefix) or + item[tox_base] in self.matrix_exclude + ): + skip_matrices.append(item) + continue + + item["tox_cmd"] = re.sub( + self.matrix_schema["tox_cmd_build"]["sub"]["pattern"], + self.matrix_schema["tox_cmd_build"]["sub"]["replace"], + item[tox_base] + ) + #logger.debug("re.sub: %s", item[tox_base]) + + for matrice in skip_matrices: + parsed_matrix.remove(matrice) + elif isinstance(parsed_matrix, list): + new_parsed_matrix = [] + for item in parsed_matrix: + if str(item) in self.matrix_exclude: + continue + tox_cmd = re.sub( + self.matrix_schema["tox_cmd_build"]["sub"]["pattern"], + self.matrix_schema["tox_cmd_build"]["sub"]["replace"], + str(item) + ) + new_parsed_matrix.append({"name": tox_cmd, "tox_cmd": tox_cmd}) + parsed_matrix = new_parsed_matrix + return parsed_matrix if self._matrix is None: