Skip to content

Commit 3eabbad

Browse files
authored
update coverage the standalone script (#383)
1 parent bdac3cf commit 3eabbad

File tree

2 files changed

+33
-13
lines changed

2 files changed

+33
-13
lines changed

CHANGELOG.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
## [0.14.2] - 2025-03-20
9-
10-
### Fixed
11-
12-
- CI: fix using schema action ([#376](https://github.com/Lightning-AI/utilities/pull/376))
13-
148

159
## [Unreleased] - YYYY-MM-DD
1610

@@ -24,11 +18,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2418
- CLI: switch from `fire` to `jsonargparse` ([#371](https://github.com/Lightning-AI/utilities/pull/371))
2519

2620

21+
- script: update usage of coverage in standalone ([#383](https://github.com/Lightning-AI/utilities/pull/383))
22+
23+
2724
### Fixed
2825

2926
-
3027

3128

29+
---
30+
31+
## [0.14.2] - 2025-03-20
32+
33+
### Fixed
34+
35+
- CI: fix using schema action ([#376](https://github.com/Lightning-AI/utilities/pull/376))
36+
37+
3238
## [0.14.1] - 2025-03-14
3339

3440
### Fixed

scripts/run_standalone_tests.sh

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,36 @@
1919
# It can be set through the env variable NUM_PARALLEL_TESTS and defaults to 5 if not set
2020
test_batch_size="${NUM_PARALLEL_TESTS:-5}"
2121

22-
# Source directory for coverage runs can be set with CODECOV_SOURCE and defaults to lightning.
23-
codecov_source="${COVERAGE_SOURCE:-"lightning"}"
22+
# Source directory for coverage runs can be set with CODECOV_SOURCE.
23+
codecov_source="${COVERAGE_SOURCE}"
2424

2525
# The test directory is passed as the first argument to the script
2626
test_dir=$1 # parse the first argument
2727

2828
# There is also timeout for the tests.
29-
# It can be set through the env variable TEST_TIMEOUT and defaults to 1200 seconds if not set 1200 seconds
29+
# It can be set through the env variable TEST_TIMEOUT and defaults to 1200 seconds.
3030
test_timeout="${TEST_TIMEOUT:-1200}"
3131

3232
# Temporary file to store the collected tests
3333
COLLECTED_TESTS_FILE="collected_tests.txt"
3434

3535
ls -lh . # show the contents of the directory
3636

37-
# Python arguments for running the tests and coverage
38-
defaults=" -m coverage run --source ${codecov_source} --append -m pytest --no-header -v -s --color=yes --timeout=${test_timeout} --durations=0 "
37+
# Clean up the coverage file if it exists
38+
if [ -n "$codecov_source" ]; then
39+
rm -f .coverage
40+
fi
41+
42+
# Check if the coverage source is empty.
43+
defaults=""
44+
# If codecov_source is set, prepend the coverage command
45+
if [ -n "$codecov_source" ]; then
46+
defaults=" -m coverage run --source ${codecov_source} --append "
47+
fi
48+
# Append the common pytest arguments
49+
defaults="${defaults} -m pytest --no-header -v -s --color=yes --timeout=${test_timeout} --durations=0 "
50+
51+
# Python arguments for running the tests and optional coverage
3952
printf "\e[35mUsing defaults: ${defaults}\e[0m\n"
4053

4154
# Get the list of parametrizations. we need to call them separately. the last two lines are removed.
@@ -79,8 +92,9 @@ elif [ $test_count -eq 0 ]; then
7992
exit 1
8093
fi
8194

82-
# clear all the collected reports
83-
rm -f parallel_test_output-*.txt # in case it exists, remove it
95+
if [ -n "$codecov_source" ]; then
96+
coverage combine
97+
fi
8498

8599
status=0 # aggregated script status
86100
report=() # final report

0 commit comments

Comments
 (0)