Show local variables on test failures

This commit is contained in:
Pedro Algarvio 2020-08-14 15:19:49 +01:00
parent ad6eee068a
commit dff88decfe
No known key found for this signature in database
GPG key ID: BB36BF6584A298FF

View file

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""
noxfile
~~~~~~~
@ -7,7 +6,6 @@ Nox configuration script
"""
# pylint: disable=resource-leakage,3rd-party-module-not-gated
from __future__ import absolute_import, print_function, unicode_literals
import datetime
import glob
@ -65,7 +63,7 @@ RUNTESTS_LOGFILE = os.path.join(
)
# Prevent Python from writing bytecode
os.environ[str("PYTHONDONTWRITEBYTECODE")] = str("1")
os.environ["PYTHONDONTWRITEBYTECODE"] = "1"
def find_session_runner(session, name, **kwargs):
@ -952,7 +950,15 @@ def _pytest(session, coverage, cmd_args):
cmd_args.append("--lf")
if coverage is True:
_run_with_coverage(
session, "python", "-m", "coverage", "run", "-m", "pytest", *cmd_args
session,
"python",
"-m",
"coverage",
"run",
"-m",
"pytest",
"--showlocals",
*cmd_args
)
else:
session.run("python", "-m", "pytest", *cmd_args, env=env)