MCPcopy
hub / github.com/saltstack/salt / _install_coverage_requirement

Function _install_coverage_requirement

noxfile.py:333–400  ·  view source on GitHub ↗
(session)

Source from the content-addressed store, hash-verified

331
332
333def _install_coverage_requirement(session):
334 if SKIP_REQUIREMENTS_INSTALL is False:
335 env = os.environ.copy()
336 env["PIP_CONSTRAINT"] = str(REPO_ROOT / "requirements" / "constraints.txt")
337 coverage_requirement = COVERAGE_REQUIREMENT
338 if coverage_requirement is None:
339 # 7.14.0 is the first version where the Python 3.14 CTracer
340 # wheel is mature. 7.3.1 (the prior pin) ships no CTracer
341 # for 3.14 and falls back to the pure-Python PyTracer, which
342 # is so slow on Salt's onedir (PyTracer × relenv runtime
343 # wrappers around sysconfig) that the functional zeromq 4
344 # shard hits the 3-hour GHA step timeout. Avoid 7.11.1
345 # through 7.11.3 — those have a known 2x performance
346 # regression on Python 3.14 (coveragepy issue #2082).
347 coverage_requirement = "coverage==7.14.0"
348 if IS_LINUX:
349 distro_slug = os.environ.get("TOOLS_DISTRO_SLUG")
350 if distro_slug is not None and distro_slug in (
351 "centos-7",
352 "debian-10",
353 "photonos-3",
354 ):
355 # Keep the old coverage requirement version since the new one, on these
356 # Plaforms turns the test suite quite slow.
357 # Unit tests don't finish before the 5 hours timeout when they should
358 # finish within 1 to 2 hours.
359 coverage_requirement = "coverage==5.5"
360 session.install(
361 "--progress-bar=off",
362 coverage_requirement,
363 silent=PIP_INSTALL_SILENT,
364 env=env,
365 )
366 # NOTE: this step runs unconditionally, including when
367 # ``SKIP_REQUIREMENTS_INSTALL`` is set — the CI test step re-uses a
368 # venv that was prepared in a *separate* nox step with installs
369 # enabled, so the install branch above is skipped here but the
370 # ``.pth`` file is already on disk and needs to be cleaned up.
371 #
372 # Coverage 7.14.0 ships an ``a1_coverage.pth`` that calls
373 # ``coverage.process_startup()`` during site init whenever
374 # ``COVERAGE_PROCESS_START`` is set in the environment. On the
375 # Salt onedir that runs *before* relenv's bootstrap
376 # ``setup_openssl()`` can load the host's FIPS provider, which
377 # leaves OpenSSL with no registered cipher implementations. The
378 # first call into ``ssl.create_default_context()`` (tornado
379 # imports it at module load) then raises::
380 #
381 # ssl.SSLError: [SSL: LIBRARY_HAS_NO_CIPHERS] library has no
382 # ciphers (_ssl.c:3188)
383 #
384 # failing pytest collection on every Photon FIPS shard.
385 # Saltfactories' sitecustomize already calls
386 # ``coverage.process_startup()`` after relenv has finished its
387 # bootstrap (it's wrapped via ``site.execsitecustomize``), so this
388 # ``.pth`` is duplicative — removing it just preserves the existing
389 # ordering. Idempotent: a no-op once the file is gone.
390 session.run(

Callers 2

_run_with_coverageFunction · 0.85
_report_coverageFunction · 0.85

Calls 4

copyMethod · 0.45
getMethod · 0.45
installMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected