MCPcopy Index your code
hub / github.com/RustPython/RustPython / display_header

Function display_header

Lib/test/libregrtest/utils.py:615–691  ·  view source on GitHub ↗
(use_resources: tuple[str, ...],
                   python_cmd: tuple[str, ...] | None)

Source from the content-addressed store, hash-verified

613
614
615def display_header(use_resources: tuple[str, ...],
616 python_cmd: tuple[str, ...] | None) -> None:
617 # Print basic platform information
618 print("==", platform.python_implementation(), *sys.version.split())
619 print("==", platform.platform(aliased=True),
620 "%s-endian" % sys.byteorder)
621 print("== Python build:", ' '.join(get_build_info()))
622 print("== cwd:", os.getcwd())
623
624 cpu_count: object = os.cpu_count()
625 if cpu_count:
626 # The function is new in Python 3.13; mypy doesn't know about it yet:
627 process_cpu_count = os.process_cpu_count() # type: ignore[attr-defined]
628 if process_cpu_count and process_cpu_count != cpu_count:
629 cpu_count = f"{process_cpu_count} (process) / {cpu_count} (system)"
630 print("== CPU count:", cpu_count)
631 print("== encodings: locale=%s FS=%s"
632 % (locale.getencoding(), sys.getfilesystemencoding()))
633
634 if use_resources:
635 text = format_resources(use_resources)
636 print(f"== {text}")
637 else:
638 print("== resources: all test resources are disabled, "
639 "use -u option to unskip tests")
640
641 cross_compile = is_cross_compiled()
642 if cross_compile:
643 print("== cross compiled: Yes")
644 if python_cmd:
645 cmd = shlex.join(python_cmd)
646 print(f"== host python: {cmd}")
647
648 get_cmd = [*python_cmd, '-m', 'platform']
649 proc = subprocess.run(
650 get_cmd,
651 stdout=subprocess.PIPE,
652 text=True,
653 cwd=os_helper.SAVEDCWD)
654 stdout = proc.stdout.replace('\n', ' ').strip()
655 if stdout:
656 print(f"== host platform: {stdout}")
657 elif proc.returncode:
658 print(f"== host platform: <command failed with exit code {proc.returncode}>")
659 else:
660 hostrunner = get_host_runner()
661 if hostrunner:
662 print(f"== host runner: {hostrunner}")
663
664 # This makes it easier to remember what to set in your local
665 # environment when trying to reproduce a sanitizer failure.
666 asan = support.check_sanitizer(address=True)
667 msan = support.check_sanitizer(memory=True)
668 ubsan = support.check_sanitizer(ub=True)
669 tsan = support.check_sanitizer(thread=True)
670 sanitizers = []
671 if asan:
672 sanitizers.append("address")

Callers 1

_run_testsMethod · 0.85

Calls 12

format_resourcesFunction · 0.85
is_cross_compiledFunction · 0.85
get_host_runnerFunction · 0.85
cpu_countMethod · 0.80
get_build_infoFunction · 0.70
printFunction · 0.50
joinMethod · 0.45
runMethod · 0.45
stripMethod · 0.45
replaceMethod · 0.45
appendMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected