File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed
Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -88,6 +88,7 @@ run = [
8888 " pytest{env:HATCH_TEST_ARGS:} {args}" ,
8989]
9090run-cov = [
91+ ' hatch --env default run "src/build_scripts/delete_old_coverage.py"' ,
9192 ' hatch --env default run "src/build_scripts/install_playwright.py"' ,
9293 " hatch --env default build -t wheel" ,
9394 " coverage run -m pytest{env:HATCH_TEST_ARGS:} {args}" ,
Original file line number Diff line number Diff line change 1+ # /// script
2+ # requires-python = ">=3.11"
3+ # dependencies = []
4+ # ///
5+
6+ import logging
7+ from glob import glob
8+ from pathlib import Path
9+
10+ # Delete old `.coverage*` files in the project root
11+ print ("Deleting old coverage files..." ) # noqa: T201
12+ root_dir = Path (__file__ ).parent .parent .parent
13+ coverage_files = glob (str (root_dir / ".coverage*" ))
14+
15+ for path in coverage_files :
16+ coverage_file = Path (path )
17+ if coverage_file .exists ():
18+ try :
19+ coverage_file .unlink ()
20+ except Exception as e :
21+ logging .error (f"Failed to delete { coverage_file } : { e } " )
You can’t perform that action at this time.
0 commit comments