Show test execution order in CI runs to help debug test suite hangs

This commit is contained in:
Pedro Algarvio 2020-04-17 21:37:42 +01:00 committed by Daniel Wozniak
parent ef9237e056
commit a0e96810fd

View file

@ -36,10 +36,12 @@ from nox.command import CommandFailed # isort:skip
IS_PY3 = sys.version_info > (2,)
# Be verbose when runing under a CI context
PIP_INSTALL_SILENT = (
os.environ.get("JENKINS_URL") or os.environ.get("CI") or os.environ.get("DRONE")
) is None
CI_RUN = (
os.environ.get("JENKINS_URL")
or os.environ.get("CI")
or os.environ.get("DRONE") is not None
)
PIP_INSTALL_SILENT = CI_RUN is False
# Global Path Definitions
REPO_ROOT = os.path.abspath(os.path.dirname(__file__))
@ -890,6 +892,14 @@ def _pytest(session, coverage, cmd_args):
# https://stackoverflow.com/questions/50168647/multiprocessing-causes-python-to-crash-and-gives-an-error-may-have-been-in-progr
env = {"OBJC_DISABLE_INITIALIZE_FORK_SAFETY": "YES"}
if CI_RUN:
# We'll print out the collected tests on CI runs.
# This will show a full list of what tests are going to run, in the right order, which, in case
# of a test suite hang, helps us pinpoint which test is hanging
session.run(
"python", "-m", "pytest", *(cmd_args + ["--collect-only", "-qqq"]), env=env
)
try:
if coverage is True:
_run_with_coverage(