Commits

Mikhail Korobov committed b5c6e4d

Code coverage integration

  • Participants
  • Parent commits 8308d67

Comments (0)

Files changed (4)

 
 #misc files
 pip-log.txt
+htmlcov
+.coverage
 
 #os files
 .DS_Store

File docs/testing.rst

 ------------
 
 In order to run tests you'll need `VirtualBox`_ 4.x and a configured OS image.
-Image should:
+Images should:
 
 * have root user with '123' password
 * have openssh server installed
 
 Tests can take a long time to run because VM is rolled back to clean
 state before each test.
+
+In order to get coverage reports, install coverage.py (``pip install coverage``)
+and the run::
+
+    cd fab_deploy_tests
+    ./runcoverage.sh <OS name> <VM name or uid>
+
+html reports will be placed in ``htmlcov`` folder.
+

File fab_deploy_tests/runcoverage.sh

+#!/bin/sh
+coverage run runtests.py $*
+coverage report --include=`pwd`/../fab_deploy/*
+coverage html --include=`pwd`/../fab_deploy/*

File fab_deploy_tests/utils.py

 import subprocess
-from time import sleep
-from os import system
 from functools import partial
 from fabric import state
 from fabric.main import get_hosts
         return subprocess.call(params)
 
     def start(self):
-        self.startvm() #'--type', 'headless')
+        # headless variant leads to invalid snapshots for some reason
+        # (bug in virtualbox?)
+        # self.startvm('--type', 'headless')
+        self.startvm()
 
     def stop(self):
         self.controlvm('poweroff')