Skip to content

Commit bda1bfa

Browse files
✨ Add help menu and ability to run specific tests for validatecodeonce
1 parent 3dfb789 commit bda1bfa

File tree

3 files changed

+38
-2
lines changed

3 files changed

+38
-2
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,16 @@ code change.
135135
This can be used for CI/CD purposes since it generates report files in the `/python/reports`
136136
folder.
137137

138+
Options:\
139+
`-h` Print help menu.
140+
```
141+
validatecodeonce -h
142+
```
143+
`-k` Invoke Pytest option `-k` to run specific tests based on a substring match to the test name.
144+
```
145+
validatecodeonce -k test_get_products
146+
```
147+
138148
### `runtests` (DEPRECATED)
139149

140150
**DEPRECATED**: Use `validatecodeonce` instead

entrypoint.sh

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,30 @@ validatecode() {
5252
}
5353

5454
validatecodeonce() {
55+
help() {
56+
echo
57+
echo "Usage: validatecodeonce [-h|k]"
58+
echo
59+
echo "Trigger a single run of code validation."
60+
echo
61+
echo "Options:"
62+
echo "h Print this help menu."
63+
echo "k Invoke Pytest option -k to run specific tests based on a substring match to the test name."
64+
echo
65+
}
66+
67+
while getopts ":h" option; do
68+
case $option in
69+
h)
70+
help
71+
exit;;
72+
esac
73+
done
74+
5575
echo -e "\nTriggering single run of code validation."
5676

5777
loadconfig
58-
../test_suite.sh reports
78+
../test_suite.sh $@ reports
5979
}
6080

6181

test_suite.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
REPORTS_FOLDER="/python/reports/"
44
SECTION_PREFIX="\n#########"
55

6+
while getopts ":k:" option; do
7+
case $option in
8+
k)
9+
SPECIFIC_TESTS="-k ${OPTARG}"
10+
esac
11+
done
612

713
reportvalidation() {
814
if [ -z "$1" ]
@@ -26,7 +32,7 @@ fi
2632

2733

2834
echo -ne "$SECTION_PREFIX RUN TESTS:\n\n"
29-
python -m pytest -vv --durations=3 --cov ./ --cov-report term-missing $PYTEST_REPORTS; STATUS1=$?
35+
python -m pytest -vv --durations=3 --cov ./ --cov-report term-missing $PYTEST_REPORTS $SPECIFIC_TESTS; STATUS1=$?
3036

3137
echo -ne "$SECTION_PREFIX CHECK TYPING: "
3238
MYPYOUT=`mypy --no-error-summary . $MYPY_REPORTS`

0 commit comments

Comments
 (0)