Skip to content

Commit 04d779c

Browse files
committed
notes
1 parent 567e0f8 commit 04d779c

File tree

2 files changed

+20
-18
lines changed

2 files changed

+20
-18
lines changed

tests/run_standalone_tests.sh

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,36 +12,36 @@
1212
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
15-
# set -e
1615

17-
# THIS FILE ASSUMES IT IS RUN INSIDE THE tests-sdk DIRECTORY. SEE BELOW FOR CUSTOMIZATION.
16+
# THIS FILE ASSUMES IT IS RUN INSIDE THE tests DIRECTORY.
1817

1918
# Batch size for testing: Determines how many standalone test invocations run in parallel
20-
# It can be set through the env variable NUM_PARALLEL_TESTS and defaults to 10 if not set
21-
22-
# Source directory for coverage runs can be set with PARALLEL_TESTS_SOURCE and defaults to
23-
# lightning_sdk.
24-
25-
# The directory to run tests from (in parallel) can be set with PARALLEL_TESTS_DIR and
26-
# defaults to the directory of this file. Should be set correctly for each test suite
27-
# (e.g. to "tests_filesystem" to run filesystem tests)
19+
# It can be set through the env variable NUM_PARALLEL_TESTS and defaults to 5 if not set
2820
test_batch_size="${NUM_PARALLEL_TESTS:-5}"
21+
22+
# Source directory for coverage runs can be set with CODECOV_SOURCE and defaults to lightning.
2923
codecov_source="${CODECOV_SOURCE:-"lightning"}"
30-
# this is the directory where the tests are located
24+
25+
# The test directory is passed as the first argument to the script
3126
test_dir=$1 # parse the first argument
32-
test_timeout="${TEST_TIMEOUT:-1200}" # set the test timeout
27+
28+
# 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
30+
test_timeout="${TEST_TIMEOUT:-1200}"
31+
32+
# 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
37+
# Python arguments for running the tests and coverage
3838
defaults=" -m coverage run --source ${codecov_source} --append -m pytest --no-header -v -s --color=yes --timeout=${test_timeout} --durations=0 "
3939
echo "Using defaults: ${defaults}"
4040

41-
# get the list of parametrizations. we need to call them separately. the last two lines are removed.
41+
# Get the list of parametrizations. we need to call them separately. the last two lines are removed.
4242
# note: if there's a syntax error, this will fail with some garbled output
4343
python -um pytest ${test_dir} -q --collect-only --pythonwarnings ignore 2>&1 > $COLLECTED_TESTS_FILE
44-
# early terminate if collection failed (e.g. syntax error)
44+
# Early terminate if collection failed (e.g. syntax error)
4545
if [[ $? != 0 ]]; then
4646
cat $COLLECTED_TESTS_FILE
4747
printf "ERROR: test collection failed!\n"
@@ -80,7 +80,7 @@ fi
8080
# clear all the collected reports
8181
rm -f parallel_test_output-*.txt # in case it exists, remove it
8282

83-
status=0 # reset the script status
83+
status=0 # aggregated script status
8484
report="" # final report
8585
pids=() # array of PID for running tests
8686
test_ids=() # array of indexes of running tests
@@ -123,13 +123,13 @@ for i in "${!tests[@]}"; do
123123
fi
124124
done
125125

126-
# print test report
126+
# print test report with exit code for each test
127127
printf '=%.s' {1..80}
128128
printf "\n$report"
129129
printf '=%.s' {1..80}
130130
printf '\n'
131131

132-
# print failed tests
132+
# print failed tests from duped logs
133133
if [[ ${#failed_tests[@]} -gt 0 ]]; then
134134
printf "Failed tests:\n"
135135
for i in "${failed_tests[@]}"; do

tests/tests_fabric/conftest.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,9 @@ def caplog(caplog):
191191

192192
@pytest.fixture(autouse=True)
193193
def leave_no_artifacts_behind():
194+
"""Checks that no artifacts are left behind after the test."""
194195
tests_root = Path(__file__).parent.parent
196+
# Ignore the __pycache__ directories
195197
files_before = {p for p in tests_root.rglob("*") if "__pycache__" not in p.parts}
196198
yield
197199
files_after = {p for p in tests_root.rglob("*") if "__pycache__" not in p.parts}

0 commit comments

Comments
 (0)