Browse Source

Switched to pytest to parallelize test execution

Stefan Schmidt 6 years ago
parent
commit
f2341903b4
4 changed files with 15 additions and 9 deletions
  1. 1 0
      .gitignore
  2. 3 9
      build.sh
  3. 0 0
      code/Test/__init__.py
  4. 11 0
      resources/requirements.txt

+ 1 - 0
.gitignore

@@ -21,6 +21,7 @@ tures/*
 code/*.pcap
 code/*.xml
 .coverage
+.pytest_cache
 htmlcov/
 dbs/
 *.csv

+ 3 - 9
build.sh

@@ -124,16 +124,10 @@ source .venv/bin/activate
 cd code
 # Execute tests
 set -e
-PRINT_COV=true
-testpath="discover -s Test/"
 if [ -e "Test/test_\$1.py" ]; then
-    testpath="Test/test_\$1.py"
-    PRINT_COV=false
-fi
-PYTHONWARNINGS="ignore" python3 -m coverage run --source=. -m unittest \$testpath >/dev/null
-if \$PRINT_COV ; then
-    python3 -m coverage html
-    python3 -m coverage report -m
+    python3 -m unittest "Test/test_\$1.py" >/dev/null
+else
+    python3 -m pytest Test --cov-config .coveragerc --cov-report html --cov=./ -n auto
 fi
 deactivate
 EOF

+ 0 - 0
code/Test/__init__.py


+ 11 - 0
resources/requirements.txt

@@ -1,12 +1,23 @@
+apipkg==1.4
+atomicwrites==1.1.5
+attrs==18.1.0
 coverage==4.5.1
 cycler==0.10.0
+execnet==1.5.0
 kiwisolver==1.0.1
 lea==2.3.5
 matplotlib==2.2.2
 memory-profiler==0.52.0
+more-itertools==4.2.0
 numpy==1.14.2
+pluggy==0.6.0
 psutil==5.4.5
+py==1.5.3
 pyparsing==2.2.0
+pytest==3.6.1
+pytest-cov==2.5.1
+pytest-forked==0.2
+pytest-xdist==1.22.2
 python-dateutil==2.7.2
 pytz==2018.4
 pyxdg==0.26