Skip to content

Commit

Permalink
FIXUP for pytest
Browse files Browse the repository at this point in the history
  • Loading branch information
apyrgio committed Feb 7, 2023
1 parent 1a77c25 commit 58cab0a
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions dev_scripts/pytest-wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
# FIXME this whole script should be removed and the respective Makefile calling line
# replaced once all supported platforms have a podman version >= v4.3.0.

import os
import re
import subprocess
import sys
Expand All @@ -30,16 +29,22 @@ def get_podman_version():
return version.split("-dev")[0] # exclude "-dev" suffix from version


def run_tests(pytest_args):
cmd = ["pytest"] + pytest_args
try:
subprocess.run(cmd, check=True)
except subprocess.CalledProcessError:
sys.exit(1)


def run_tests_in_parallel(pytest_args):
print("running tests in parallel")
args = ["pytest"] + pytest_args + ["-n", "4"]
os.execvp(args[0], args)
run_tests(pytest_args + ["-n", "4"])


def run_tests_in_sequence(pytest_args):
print("running tests sequentially")
args = ["pytest"] + pytest_args
os.execvp(args[0], args)
run_tests(pytest_args)


if __name__ == "__main__":
Expand Down

0 comments on commit 58cab0a

Please sign in to comment.