Skip to content

🐛 Fix issue with validatecodeonce options, ✨ add help menu and ability to run specific tests for validatecode #362

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Aug 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ ENTRYPOINT ["/python/entrypoint.sh"]

# Add convenient aliases
# Install python packages
RUN echo "#!/bin/bash\n/python/entrypoint.sh startapp" >> /bin/startapp && chmod a+x /bin/startapp \
&& echo "#!/bin/bash\n/python/entrypoint.sh developapp" >> /bin/developapp && chmod a+x /bin/developapp \
&& echo "#!/bin/bash\n/python/entrypoint.sh validatecode" >> /bin/validatecode && chmod a+x /bin/validatecode \
&& echo "#!/bin/bash\n/python/entrypoint.sh validatecodeonce" >> /bin/validatecodeonce && chmod a+x /bin/validatecodeonce \
&& echo "#!/bin/bash\n/python/entrypoint.sh runtests" >> /bin/runtests && chmod a+x /bin/runtests
RUN echo "#!/bin/bash\n/python/entrypoint.sh startapp \$@" >> /bin/startapp && chmod a+x /bin/startapp \
&& echo "#!/bin/bash\n/python/entrypoint.sh developapp \$@" >> /bin/developapp && chmod a+x /bin/developapp \
&& echo "#!/bin/bash\n/python/entrypoint.sh validatecode \$@" >> /bin/validatecode && chmod a+x /bin/validatecode \
&& echo "#!/bin/bash\n/python/entrypoint.sh validatecodeonce \$@" >> /bin/validatecodeonce && chmod a+x /bin/validatecodeonce \
&& echo "#!/bin/bash\n/python/entrypoint.sh runtests \$@" >> /bin/runtests && chmod a+x /bin/runtests
# Change users
USER python

Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,16 @@ plugin.
This code validation command executes the `/python/test_suite.sh` script which can
be overwritten with custom code validation.

Options:\
`-h` Print help menu.
```
validatecode -h
```
`-k` Invoke Pytest option `-k` to run specific tests based on a substring match to the test name.
```
validatecode -k test_get_products
```

### `validatecodeonce`

Same as `validatecode` but executed once rather than continously running on
Expand Down
23 changes: 21 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,29 @@ developapp() {


validatecode() {
help() {
echo
echo "Usage: validatecode [-h|k]"
echo
echo "Automatically run code validation whenever the code changes."
echo
echo "Options:"
echo "h Print this help menu."
echo "k Invoke Pytest option -k to run specific tests based on a substring match to the test name."
echo
}

while getopts ":h" option; do
case $option in
h)
help
exit;;
esac
done

echo -e "\nREADY TO RUN THE CODE VALIDATION SUITE\nSave a python file to trigger the checks."

loadconfig
watchmedo shell-command --patterns="*.py;*.txt" --recursive --command="/python/test_suite.sh" --drop .
watchmedo shell-command --patterns="*.py;*.txt" --recursive --command="/python/test_suite.sh \$@" --drop .
}

validatecodeonce() {
Expand Down