-
Notifications
You must be signed in to change notification settings - Fork 0
/
debug_env.py
executable file
·38 lines (31 loc) · 1.13 KB
/
debug_env.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# debug_env.py - Environment debugging script
import sys
import subprocess
import pkg_resources
def print_section(title):
print("\n" + "="*50)
print(title)
print("="*50)
def run_command(cmd):
try:
result = subprocess.run(cmd, capture_output=True, text=True)
print(f"Command: {' '.join(cmd)}")
print("Output:")
print(result.stdout)
if result.stderr:
print("Errors:")
print(result.stderr)
except Exception as e:
print(f"Error running command: {e}")
print_section("Python Information")
print(f"Python Version: {sys.version}")
print(f"Python Executable: {sys.executable}")
print_section("Installed Packages")
installed_packages = [f"{dist.key} {dist.version}" for dist in pkg_resources.working_set]
print("\n".join(sorted(installed_packages)))
print_section("Pytest Version Check")
run_command([sys.executable, "-m", "pytest", "--version"])
print_section("Coverage Installation Check")
run_command([sys.executable, "-m", "pip", "list", "|", "grep", "coverage"])
print_section("Pytest Plugins")
run_command([sys.executable, "-m", "pytest", "--trace-config"])