MCPcopy Index your code
hub / github.com/saltstack/salt / _pytest

Function _pytest

noxfile.py:1049–1111  ·  view source on GitHub ↗
(session, coverage, cmd_args, env=None, on_rerun=False)

Source from the content-addressed store, hash-verified

1047
1048
1049def _pytest(session, coverage, cmd_args, env=None, on_rerun=False):
1050 # Create required artifacts directories
1051 _create_ci_directories()
1052
1053 if env is None:
1054 env = {}
1055
1056 env["CI_RUN"] = "1" if CI_RUN else "0"
1057
1058 args = [
1059 "--rootdir",
1060 str(REPO_ROOT),
1061 "--log-file-level=debug",
1062 "--show-capture=no",
1063 "-ra",
1064 "-s",
1065 "-vv",
1066 "--showlocals",
1067 ]
1068 for arg in cmd_args:
1069 if arg == "--log-file" or arg.startswith("--log-file="):
1070 break
1071 else:
1072 args.append(f"--log-file={RUNTESTS_LOGFILE}")
1073 args.extend(cmd_args)
1074
1075 if PRINT_SYSTEM_INFO_ONLY and "--sys-info-and-exit" not in args:
1076 args.append("--sys-info-and-exit")
1077 session.run("python", "-m", "pytest", *args, env=env)
1078 return
1079
1080 if PRINT_SYSTEM_INFO and "--sysinfo" not in args:
1081 args.append("--sysinfo")
1082
1083 if PRINT_TEST_SELECTION:
1084 # We'll print out the collected tests on CI runs.
1085 # This will show a full list of what tests are going to run, in the right order, which, in case
1086 # of a test suite hang, helps us pinpoint which test is hanging
1087 session.run(
1088 "python", "-m", "pytest", *(args + ["--collect-only", "-qqq"]), env=env
1089 )
1090 if PRINT_TEST_PLAN_ONLY:
1091 return
1092
1093 if coverage is True:
1094 _coverage_cmd_args = []
1095 if "COVERAGE_CONTEXT" in os.environ:
1096 _coverage_cmd_args.append(f"--context={os.environ['COVERAGE_CONTEXT']}")
1097 _run_with_coverage(
1098 session,
1099 "python",
1100 "-m",
1101 "coverage",
1102 "run",
1103 *_coverage_cmd_args,
1104 "-m",
1105 "pytest",
1106 *args,

Callers 5

test_parametrizedFunction · 0.85
test_cloudFunction · 0.85
test_tornadoFunction · 0.85
_ci_testFunction · 0.85
ci_test_onedir_pkgsFunction · 0.85

Calls 5

_create_ci_directoriesFunction · 0.85
_run_with_coverageFunction · 0.85
appendMethod · 0.45
extendMethod · 0.45
runMethod · 0.45

Tested by 3

test_parametrizedFunction · 0.68
test_cloudFunction · 0.68
test_tornadoFunction · 0.68