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_flow.sh 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. #
  25. # Unittest Flow
  26. #
  27. $PYT3_CMD src/unittest.py clean
  28. echo -e "\e[1m * Erasing collected coverage information\e[0m"
  29. $COV2_CMD erase
  30. $COV2_CMD run -a --branch --source=$($PYT3_CMD src/config.py -p) src/unittest.py run $*
  31. $COV3_CMD run -a --branch --source=$($PYT3_CMD src/config.py -p) src/unittest.py run $*
  32. echo -e "\e[1m\e[93mCreating Coverage-XML-File: $(pwd)/testresults/coverage.xml\e[0m"
  33. $COV3_CMD xml -o testresults/coverage.xml
  34. $PYT3_CMD src/unittest.py finalise
  35. $PYT3_CMD src/unittest.py status
  36. $PYT3_CMD src/unittest.py pdf
  37. $PDF_CMD testresults/unittest.pdf