123456789101112131415161718192021222324252627282930313233343536373839 |
- #!/bin/bash
-
- #
- # Set commands depending on distribution
- #
- . /etc/os-release
- # python2
- if [[ "$ID" == "arch" || "$ID" == "manjaro" || "$ID_LIKE" == *"opensuse"* || "$ID" == "solus" ]]; then
- COV2_CMD="coverage2"
- PYT2_CMD="python2"
- else
- COV2_CMD="python2-coverage"
- PYT2_CMD="python2"
- fi
- # python3
- if [[ "$ID" == "arch" || "$ID" == "manjaro" || "$ID_LIKE" == *"opensuse"* || "$ID" == "solus" ]]; then
- COV3_CMD="coverage3"
- PYT3_CMD="python3"
- else
- COV3_CMD="python3-coverage"
- PYT3_CMD="python3"
- fi
- # pdf viewer
- PDF_CMD="xdg-open"
-
- #
- # Unittest Flow
- #
- $PYT3_CMD src/unittest.py clean
- echo -e "\e[1m * Erasing collected coverage information\e[0m"
- $COV2_CMD erase
- $COV2_CMD run -a --branch --source=$($PYT3_CMD src/config.py -p) src/unittest.py run $*
- $COV3_CMD run -a --branch --source=$($PYT3_CMD src/config.py -p) src/unittest.py run $*
- echo -e "\e[1m\e[93mCreating Coverage-XML-File: $(pwd)/testresults/coverage.xml\e[0m"
- $COV3_CMD xml -o testresults/coverage.xml
- $PYT3_CMD src/unittest.py finalise
- $PYT3_CMD src/unittest.py status
- $PYT3_CMD src/unittest.py pdf
- $PDF_CMD testresults/unittest.pdf
|