File tree Expand file tree Collapse file tree 3 files changed +46
-7
lines changed
Expand file tree Collapse file tree 3 files changed +46
-7
lines changed Original file line number Diff line number Diff line change 66import sys
77import argparse
88from datetime import datetime
9+ from pathlib import Path
910
1011# APIM Samples imports
1112import azure_resources as az
1213
1314
15+ def _get_suggested_purge_command () -> str :
16+ """Return a purge command that works from the current working directory."""
17+
18+ script_path = Path (__file__ ).resolve ()
19+ cwd_path = Path .cwd ().resolve ()
20+
21+ try :
22+ rel_path = script_path .relative_to (cwd_path )
23+ return f'python { rel_path .as_posix ()} --purge'
24+ except ValueError :
25+ return f'python "{ script_path } " --purge'
26+
27+
1428def parse_date (date_str : str ) -> str :
1529 """Parse and format date string for display."""
1630 if not date_str :
@@ -349,7 +363,7 @@ def main():
349363 print ('\n ❌ Purge operation cancelled' )
350364 else :
351365 print ('\n 💡 To purge all these resources, run:' )
352- print (' python shared/python/show_soft_deleted_resources.py --purge ' )
366+ print (f ' { _get_suggested_purge_command () } ' )
353367
354368 print ()
355369 return 0
Original file line number Diff line number Diff line change 1- # PowerShell script to run pytest with coverage and store .coverage in tests/python
2- $env: COVERAGE_FILE = " tests/python/.coverage"
3- pytest - v -- cov= shared/ python -- cov- config= tests/ python/ .coveragerc -- cov- report= html:tests/ python/ htmlcov tests/ python/
1+ # !/usr/bin/env pwsh
2+
3+ # PowerShell script to run pytest with coverage.
4+ # This script can be run from any working directory.
5+
6+ $ErrorActionPreference = " Stop"
7+
8+ $ScriptDir = $PSScriptRoot
9+ $RepoRoot = (Resolve-Path (Join-Path $ScriptDir " ..\.." ))
10+
11+ Push-Location $RepoRoot
12+ try {
13+ $env: COVERAGE_FILE = (Join-Path $RepoRoot " tests/python/.coverage" )
14+ pytest - v -- cov= shared/ python -- cov- config= tests/ python/ .coveragerc -- cov- report= html:tests/ python/ htmlcov tests/ python/
15+ }
16+ finally {
17+ Pop-Location
18+ }
Original file line number Diff line number Diff line change 1- # Shell script to run pytest with coverage and store .coverage in tests/python
2- COVERAGE_FILE=tests/python/.coverage
3- export COVERAGE_FILE
1+ #! /usr/bin/env bash
2+
3+ # Shell script to run pytest with coverage.
4+ # This script can be run from any working directory.
5+
6+ set -euo pipefail
7+
8+ SCRIPT_DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd) "
9+ REPO_ROOT=" $( cd " ${SCRIPT_DIR} /../.." && pwd) "
10+
11+ cd " ${REPO_ROOT} "
12+
13+ export COVERAGE_FILE=" tests/python/.coverage"
414pytest -v --cov=shared/python --cov-config=tests/python/.coveragerc --cov-report=html:tests/python/htmlcov tests/python/
You can’t perform that action at this time.
0 commit comments