add pytest-order

This commit is contained in:
sommersoft 2022-03-27 09:01:05 -05:00
parent 33ababbaed
commit 4d2cd34b94
3 changed files with 56 additions and 15 deletions

View File

@ -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:

View File

@ -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"
}
}

View File

@ -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: