(session, transport, onedir=False)
| 1112 | |
| 1113 | |
| 1114 | def _ci_test(session, transport, onedir=False): |
| 1115 | # Install requirements |
| 1116 | _install_requirements(session, onedir=onedir) |
| 1117 | env = {} |
| 1118 | if onedir: |
| 1119 | env["ONEDIR_TESTRUN"] = "1" |
| 1120 | chunks = { |
| 1121 | "pkg": [ |
| 1122 | "tests/pytests/pkg", |
| 1123 | ], |
| 1124 | "unit": [ |
| 1125 | "tests/unit", |
| 1126 | "tests/pytests/unit", |
| 1127 | ], |
| 1128 | "functional": [ |
| 1129 | "tests/pytests/functional", |
| 1130 | ], |
| 1131 | "scenarios": [ |
| 1132 | "tests/pytests/scenarios", |
| 1133 | ], |
| 1134 | } |
| 1135 | |
| 1136 | test_group_number = os.environ.get("TEST_GROUP") or "1" |
| 1137 | |
| 1138 | if not session.posargs: |
| 1139 | chunk_cmd = [] |
| 1140 | junit_report_filename = "test-results" |
| 1141 | runtests_log_filename = "runtests" |
| 1142 | else: |
| 1143 | chunk = session.posargs.pop(0) |
| 1144 | if chunk in ["unit", "functional", "integration", "scenarios", "all"]: |
| 1145 | if chunk == "all": |
| 1146 | chunk_cmd = [] |
| 1147 | junit_report_filename = "test-results" |
| 1148 | runtests_log_filename = "runtests" |
| 1149 | elif chunk == "integration": |
| 1150 | chunk_cmd = [] |
| 1151 | for values in chunks.values(): |
| 1152 | for value in values: |
| 1153 | chunk_cmd.append(f"--ignore={value}") |
| 1154 | junit_report_filename = f"test-results-{chunk}-grp{test_group_number}" |
| 1155 | runtests_log_filename = f"runtests-{chunk}-grp{test_group_number}" |
| 1156 | else: |
| 1157 | chunk_cmd = chunks[chunk] |
| 1158 | junit_report_filename = f"test-results-{chunk}-grp{test_group_number}" |
| 1159 | runtests_log_filename = f"runtests-{chunk}-grp{test_group_number}" |
| 1160 | if session.posargs: |
| 1161 | if session.posargs[0] == "--": |
| 1162 | session.posargs.pop(0) |
| 1163 | chunk_cmd.extend(session.posargs) |
| 1164 | else: |
| 1165 | chunk_cmd = [chunk] + session.posargs |
| 1166 | junit_report_filename = f"test-results-grp{test_group_number}" |
| 1167 | runtests_log_filename = f"runtests-grp{test_group_number}" |
| 1168 | |
| 1169 | rerun_failures = os.environ.get("RERUN_FAILURES", "0") == "1" |
| 1170 | track_code_coverage = os.environ.get("SKIP_CODE_COVERAGE", "0") == "0" |
| 1171 |
no test coverage detected