Skip to content

Commit

Permalink
debug: misc improvements to debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
nedbat committed Jan 12, 2024
1 parent 2d9d6d1 commit f9e202a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,18 @@ help: ## Show this help.
@echo Available targets:
@awk -F ':.*##' '/^[^: ]+:.*##/{printf " \033[1m%-20s\033[m %s\n",$$1,$$2} /^##@/{printf "\n%s\n",substr($$0,5)}' $(MAKEFILE_LIST)

clean_platform:
_clean_platform:
@rm -f *.so */*.so
@rm -f *.pyd */*.pyd
@rm -rf __pycache__ */__pycache__ */*/__pycache__ */*/*/__pycache__ */*/*/*/__pycache__ */*/*/*/*/__pycache__
@rm -f *.pyc */*.pyc */*/*.pyc */*/*/*.pyc */*/*/*/*.pyc */*/*/*/*/*.pyc
@rm -f *.pyo */*.pyo */*/*.pyo */*/*/*.pyo */*/*/*/*.pyo */*/*/*/*/*.pyo
@rm -f *$$py.class */*$$py.class */*/*$$py.class */*/*/*$$py.class */*/*/*/*$$py.class */*/*/*/*/*$$py.class

clean: clean_platform ## Remove artifacts of test execution, installation, etc.
debug_clean: ## Delete various debugging artifacts.
@rm -rf /tmp/dis $$COVERAGE_DEBUG_FILE

clean: debug_clean _clean_platform ## Remove artifacts of test execution, installation, etc.
@echo "Cleaning..."
@-pip uninstall -yq coverage
@mkdir -p build # so the chmod won't fail if build doesn't exist
Expand Down
2 changes: 1 addition & 1 deletion coverage/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -600,11 +600,11 @@ def read_coverage_config(
if specified_file:
raise ConfigError(f"Couldn't read {fname!r} as a config file")

# $set_env.py: COVERAGE_DEBUG - Options for --debug.
# 3) from environment variables:
env_data_file = os.getenv("COVERAGE_FILE")
if env_data_file:
config.data_file = env_data_file
# $set_env.py: COVERAGE_DEBUG - Debug options: https://coverage.rtfd.io/cmd.html#debug
debugs = os.getenv("COVERAGE_DEBUG")
if debugs:
config.debug.extend(d.strip() for d in debugs.split(","))
Expand Down
1 change: 1 addition & 0 deletions coverage/debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,7 @@ def get_one(
if file_name is not None:
fileobj = open(file_name, "a", encoding="utf-8")
else:
# $set_env.py: COVERAGE_DEBUG_FILE - Where to write debug output
file_name = os.getenv("COVERAGE_DEBUG_FILE", FORCED_DEBUG_FILE)
if file_name in ("stdout", "stderr"):
fileobj = getattr(sys, file_name)
Expand Down
6 changes: 3 additions & 3 deletions lab/pick.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@
as in::
te py311 -- -vvv -n 0 --select-cmd="python lab/pick.py sample 10 < tests.txt"
te py311 -- -vvv -n 0 --cache-clear --select-cmd="python lab/pick.py sample 10 < tests.txt"
or::
for n in 1 1 2 2 3 3; do te py311 -- -vvv -n 0 --select-cmd="python lab/pick.py sample 3 $n < tests.txt"; done
for n in 1 1 2 2 3 3; do te py311 -- -vvv -n 0 --cache-clear --select-cmd="python lab/pick.py sample 3 $n < tests.txt"; done
or::
for n in $(seq 1 10); do echo seed=$n; COVERAGE_COVERAGE=yes te py311 -- -n 0 --select-cmd="python lab/pick.py sample 20 $n < tests.txt"; done
for n in $(seq 1 10); do echo seed=$n; COVERAGE_COVERAGE=yes te py311 -- -n 0 --cache-clear --select-cmd="python lab/pick.py sample 20 $n < tests.txt"; done
"""

Expand Down

0 comments on commit f9e202a

Please sign in to comment.