Skip to content

Commit

Permalink
fix: support multiple python versions for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinBernstorff committed Apr 20, 2023
1 parent 59b2ba4 commit d929147
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,8 @@ def update(c: Context):
@task(iterable="pytest_args")
def test(
c: Context,
pytest_args: List[str] = [], # noqa
python_versions: str = "3.9",
pytest_args: List[str] = [], # noqa
):
"""Run tests"""
echo_header(f"{Emo.TEST} Running tests")
Expand All @@ -256,10 +256,13 @@ def test(
]

pytest_arg_str = " ".join(pytest_args)
python_versions = python_versions.replace(".", "")

python_version_list = python_versions.replace(".", "").split(",")
python_version_strings = [f"py{v}" for v in python_version_list]
python_version_arg_string = ",".join(python_version_strings)

test_result: Result = c.run(
f"tox -e py{python_versions} -- {pytest_arg_str}",
f"tox -e {python_version_arg_string} -- {pytest_arg_str}",
warn=True,
pty=True,
)
Expand Down

0 comments on commit d929147

Please sign in to comment.