misc cleanup and standardizing
This commit is contained in:
parent
5f1137b347
commit
4d027263f3
|
@ -57,8 +57,7 @@ jobs:
|
||||||
docker_profile: "nodb"
|
docker_profile: "nodb"
|
||||||
jobs: "test"
|
jobs: "test"
|
||||||
workflow_name: "pythontests.yml"
|
workflow_name: "pythontests.yml"
|
||||||
matrix_exclude: |
|
matrix_exclude: 3.6
|
||||||
3.6
|
|
||||||
|
|
||||||
- name: "pytest-mock"
|
- name: "pytest-mock"
|
||||||
repo: "pytest-dev/pytest-mock"
|
repo: "pytest-dev/pytest-mock"
|
||||||
|
@ -81,7 +80,6 @@ jobs:
|
||||||
docker_profile: "nodb"
|
docker_profile: "nodb"
|
||||||
jobs: "build"
|
jobs: "build"
|
||||||
workflow_name: "main.yml"
|
workflow_name: "main.yml"
|
||||||
# Exclude pypy3 for now; stil working on a suitable regex substitution
|
|
||||||
matrix_exclude: ""
|
matrix_exclude: ""
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|
|
@ -59,7 +59,7 @@ else:
|
||||||
|
|
||||||
|
|
||||||
def load_matrix_schema(repo: str) -> SchemaType:
|
def load_matrix_schema(repo: str) -> SchemaType:
|
||||||
"""Loads the matrix schema for `repo`"""
|
"""Loads the matrix schema for ``repo``"""
|
||||||
schema: SchemaType = {"repo": repo}
|
schema: SchemaType = {"repo": repo}
|
||||||
working_dir = os.getcwd()
|
working_dir = os.getcwd()
|
||||||
schema_path = os.path.join(
|
schema_path = os.path.join(
|
||||||
|
@ -111,10 +111,6 @@ class ToxDepFilter(_BaseUserDict):
|
||||||
"""Checks if ``match`` matches any conditions"""
|
"""Checks if ``match`` matches any conditions"""
|
||||||
match_found = None
|
match_found = None
|
||||||
for key, val in self.data.items():
|
for key, val in self.data.items():
|
||||||
if "xdist" in match:
|
|
||||||
logging.debug(
|
|
||||||
"matches_condition: %s", re.search(val["condition"], match)
|
|
||||||
)
|
|
||||||
if re.search(val["condition"], match):
|
if re.search(val["condition"], match):
|
||||||
match_found = key
|
match_found = key
|
||||||
break
|
break
|
||||||
|
@ -160,7 +156,7 @@ class DownstreamRunner:
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def yaml_tree(self) -> dict[str, Any]:
|
def yaml_tree(self) -> dict[str, Any]:
|
||||||
"""The YAML tree built from the `self.yaml_source` file."""
|
"""The YAML tree built from the ``self.yaml_source`` file."""
|
||||||
if self._yaml_tree is None:
|
if self._yaml_tree is None:
|
||||||
with open(self.yaml_source) as f:
|
with open(self.yaml_source) as f:
|
||||||
try:
|
try:
|
||||||
|
@ -179,7 +175,8 @@ class DownstreamRunner:
|
||||||
|
|
||||||
def inject_pytest_dep(self) -> None:
|
def inject_pytest_dep(self) -> None:
|
||||||
"""Ensure pytest is a dependency in tox.ini to allow us to use the 'local'
|
"""Ensure pytest is a dependency in tox.ini to allow us to use the 'local'
|
||||||
version of pytest.
|
version of pytest. Also ensure other dependencies in ``TOX_DEP_FILTERS``
|
||||||
|
are defined appropriately.
|
||||||
"""
|
"""
|
||||||
ini_path = self.repo + "/tox.ini"
|
ini_path = self.repo + "/tox.ini"
|
||||||
pytest_dep = TOX_DEP_FILTERS["pytest"]["src"]
|
pytest_dep = TOX_DEP_FILTERS["pytest"]["src"]
|
||||||
|
@ -215,18 +212,18 @@ class DownstreamRunner:
|
||||||
f"repo={self.repo}, "
|
f"repo={self.repo}, "
|
||||||
f"yaml_source={self.yaml_source}, "
|
f"yaml_source={self.yaml_source}, "
|
||||||
f"job_names={self.job_names}, "
|
f"job_names={self.job_names}, "
|
||||||
f"matrix={self.matrix}, "
|
f"matrix={self._matrix}, "
|
||||||
")"
|
")"
|
||||||
)
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def matrix(self) -> dict[str, Iterable[dict[str, str]]]:
|
def matrix(self) -> dict[str, Iterable[dict[str, str]]]:
|
||||||
"""Iterates over ``self.yaml_tree`` strategy matrix for each job in ``self.jobs``, and passes each
|
"""Iterates over ``self.yaml_tree``'s strategy matrix for each job in ``self.jobs``, and passes each
|
||||||
through ``parse_matrix``.
|
through ``parse_matrix``.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def parse_matrix(yaml_tree: dict[str, Any]) -> Iterable[Any]:
|
def parse_matrix(yaml_tree: dict[str, Any]) -> Iterable[Any]:
|
||||||
"""Parses `yaml_tree` strategy matrix using ``self.matrix_schema`` information."""
|
"""Parses ``yaml_tree`` strategy matrix using ``self.matrix_schema`` information."""
|
||||||
parsed_matrix = [] # type: ignore
|
parsed_matrix = [] # type: ignore
|
||||||
pre_parsed: dict[str, Any] | Iterable[str | float] = yaml_tree
|
pre_parsed: dict[str, Any] | Iterable[str | float] = yaml_tree
|
||||||
for key in self.matrix_schema["matrix"]:
|
for key in self.matrix_schema["matrix"]:
|
||||||
|
|
Loading…
Reference in New Issue