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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. COV2_CMD=venv2/bin/coverage
  2. COV3_CMD=venv3/bin/coverage
  3. PYT2_CMD=venv2/bin/python
  4. PYT3_CMD=venv3/bin/python
  5. PDF_CMD=xdg-open
  6. OUTDIR=testresults
  7. TEXFILE=$(OUTDIR)/unittest.tex
  8. PDFFILE=$(OUTDIR)/unittest.pdf
  9. .PHONY: all help release full short smoke single testrun_full testrun_short testrun_smoke testrun_single coverage_analysis finalise status compile release_testcases publish view clean
  10. all: full
  11. help:
  12. @echo "make [target]"
  13. @echo " Here is a list of the most helpfull targets:"
  14. @echo " - release: Release the testcases, creates a pdf ducument including all testcases and copy testdata to the module"
  15. @echo " ----------------------------------------------------------------------------------------------------------------"
  16. @echo " - full: Create a pdf ducument including all testcases"
  17. @echo " - short: Create a pdf ducument including most testcases"
  18. @echo " - smoke: Create a pdf ducument including some testcases"
  19. @echo " - single: Create a pdf ducument including one testcases"
  20. @echo " ----------------------------------------------------------------------------------------------------------------"
  21. @echo " - testrun_full: Run all testcases"
  22. @echo " - testrun_short: Run most testcases"
  23. @echo " - testrun_smoke: Run some testcases"
  24. @echo " - testrun_single: Run one testcases"
  25. release: testrun_full coverage_analysis finalise compile publish status
  26. full: testrun_full finalise compile status
  27. short: testrun_short finalise compile status
  28. smoke: testrun_smoke finalise compile status
  29. single: testrun_single finalise compile status
  30. venv:
  31. @[[ -d venv2 ]] || make venv2
  32. @[[ -d venv3 ]] || make venv3
  33. venv2:
  34. virtualenv -p /usr/bin/python2 venv2
  35. venv2/bin/pip install --upgrade pip
  36. venv2/bin/pip install -r requirements.txt
  37. venv3:
  38. virtualenv -p /usr/bin/python3 venv3
  39. venv3/bin/pip install --upgrade pip
  40. venv3/bin/pip install -r requirements.txt
  41. clean: venv
  42. @echo -e "\033[1;33mCleaning up unittest...\e[0m"
  43. @echo -e "\e[1m * Testresults from last testrun\e[0m"
  44. @ls testresults | xargs -i echo " testresults/{}"
  45. @ls testresults | xargs -i rm -f "testresults/{}"
  46. @echo -e "\e[1m * Collected coverage information\e[0m"
  47. @$(COV3_CMD) erase
  48. cleanall: clean
  49. @echo -e "\e[1m * Virtualenv\e[0m"
  50. @rm -rf venv?
  51. release_testcases:
  52. @$(PYT3_CMD) src/unittest/scripts/unittest.py release_testcases
  53. prepare: venv
  54. @$(PYT3_CMD) src/unittest/scripts/unittest.py prepare
  55. testrun_full: clean prepare
  56. @$(COV2_CMD) run -a --branch --source=`$(PYT3_CMD) src/config.py -p` src/unittest/scripts/unittest.py testrun -e full
  57. @$(COV3_CMD) run -a --branch --source=`$(PYT3_CMD) src/config.py -p` src/unittest/scripts/unittest.py testrun -e full
  58. testrun_short: clean prepare
  59. @$(COV2_CMD) run -a --branch --source=`$(PYT3_CMD) src/config.py -p` src/unittest/scripts/unittest.py testrun -e short
  60. @$(COV3_CMD) run -a --branch --source=`$(PYT3_CMD) src/config.py -p` src/unittest/scripts/unittest.py testrun -e short
  61. testrun_smoke: clean prepare
  62. @$(COV2_CMD) run -a --branch --source=`$(PYT3_CMD) src/config.py -p` src/unittest/scripts/unittest.py testrun -e smoke
  63. @$(COV3_CMD) run -a --branch --source=`$(PYT3_CMD) src/config.py -p` src/unittest/scripts/unittest.py testrun -e smoke
  64. testrun_single: clean prepare
  65. @$(COV2_CMD) run -a --branch --source=`$(PYT3_CMD) src/config.py -p` src/unittest/scripts/unittest.py testrun -e single
  66. @$(COV3_CMD) run -a --branch --source=`$(PYT3_CMD) src/config.py -p` src/unittest/scripts/unittest.py testrun -e single
  67. coverage_analysis:
  68. @echo "\e[1m\e[93mCreating Coverage-XML-File: $(pwd)/testresults/coverage.xml\e[0m"
  69. @$(COV3_CMD) xml -o testresults/coverage.xml
  70. finalise: coverage_analysis
  71. @$(PYT3_CMD) src/unittest/scripts/unittest.py finalise
  72. compile:
  73. @latexmk -pdf -quiet -pdflatex="pdflatex -interaction=nonstopmode" -output-directory=$(OUTDIR) -use-make $(TEXFILE) > /dev/null
  74. status:
  75. @$(PYT3_CMD) src/unittest/scripts/unittest.py status
  76. publish:
  77. @$(PYT3_CMD) src/unittest/scripts/unittest.py publish
  78. view:
  79. @$(PDF_CMD) $(PDFFILE)