Python Library Unittest
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

unittest.sh 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #!/bin/bash
  2. #
  3. # Set commands depending on distribution
  4. #
  5. . /etc/os-release
  6. # python2
  7. if [[ "$ID" == "arch" || "$ID" == "manjaro" || "$ID_LIKE" == *"opensuse"* || "$ID" == "solus" ]]; then
  8. COV2_CMD="coverage2"
  9. PYT2_CMD="python2"
  10. else
  11. COV2_CMD="python2-coverage"
  12. PYT2_CMD="python2"
  13. fi
  14. # python3
  15. if [[ "$ID" == "arch" || "$ID" == "manjaro" || "$ID_LIKE" == *"opensuse"* || "$ID" == "solus" ]]; then
  16. COV3_CMD="coverage3"
  17. PYT3_CMD="python3"
  18. else
  19. COV3_CMD="python3-coverage"
  20. PYT3_CMD="python3"
  21. fi
  22. # pdf viewer
  23. PDF_CMD="xdg-open"
  24. if [[ $# -eq 0 || ($# -eq 2 && $1 == '-e') ]]; then
  25. #
  26. # Unittest Flow
  27. #
  28. $PYT3_CMD unittest.py clean
  29. echo -e "\e[1m * Erasing collected coverage information\e[0m"
  30. $COV2_CMD erase
  31. $COV2_CMD run -a --branch --source=$($PYT3_CMD src/config.py -p) unittest.py run $*
  32. $COV3_CMD run -a --branch --source=$($PYT3_CMD src/config.py -p) unittest.py run $*
  33. echo -e "\e[1m\e[93mCreating Coverage-XML-File: $(pwd)/testresults/coverage.xml\e[0m"
  34. $COV3_CMD xml -o testresults/coverage.xml
  35. $PYT3_CMD unittest.py finalise
  36. $PYT3_CMD unittest.py status
  37. $PYT3_CMD unittest.py pdf
  38. $PDF_CMD testresults/unittest.pdf
  39. else
  40. $PYT3_CMD unittest.py $*
  41. fi
  42. exit 0