1. Ralph Bean
  2. tw2-tests

Commits

Ralph Bean  committed aca7ffa

Warming up to testing and coverage.

  • Participants
  • Parent commits 5d68d24
  • Branches default

Comments (0)

Files changed (3)

File .gitignore

View file
  • Ignore whitespace
 *.pyc
 tw2*
 *.swp
+htmlcov/htmlcov*
+htmlcov/index.html

File htmlcov/.ph

  • Ignore whitespace
Empty file added.

File repolist.py

View file
  • Ignore whitespace
 import shutil
 
 bitbucket_repos = {
-    'tw2.core' : 'toscawidgets',
+    # THIS IS UNBEARABLE.  TODO -- change to tw2.core
+    'tw2core' : 'ralphbean',
 }
 github_repos = {
     'tw2.jit' : 'ralphbean',
 
     @property
     def test_command(self):
-        return 'cd %s ; python setup.py nosetests ; cd -' % self.name
+        commands = [
+            "cd %s" % self.name,
+            "rmvirtualenv %s-venv" % self.name,
+            "mkvirtualenv --no-site-packages %s-venv" % self.name,
+            "pip install coverage",
+            "python setup.py develop",
+            "coverage run --source=tw2/ setup.py test",
+            "COV=$(coverage report | tail -1 | awk ' { print $4 } ')",
+            "coverage html",
+            "mv htmlcov ../htmlcov/htmlcov-%s" % self.name,
+            "deactivate",
+            "cd -",
+            "notify-send '%s' \"$COV\"" % self.name,
+            "echo \"%s $COV\" >> htmlcov/index.html" % self.name,
+        ]
+        return " ; ".join(commands)
 
 repos = {}
 
 
 def destroy():
     """ rm -rf tw2* """
-    d, dirs, files = list(os.walk('/'.join(__file__.split('/')[:-1])))[0]
+    print "Destroying."
+    current_dir = '/'.join(__file__.split('/')[:-1])
+    d, dirs, files = list(os.walk(current_dir))[0]
     for d in dirs:
         if not d.startswith('tw2'):
+            print " Ignoring directory", d
+            continue
+        print " Removing", d
+        shutil.rmtree(d)
+    d, dirs, files = list(os.walk(current_dir+"/htmlcov/"))[0]
+    for d in dirs:
+        if not d.startswith('htmlcov'):
             print "Ignoring directory", d
             continue
+        d = 'htmlcov/'+d
+        print " Removing", d
         shutil.rmtree(d)
+    print "Destroyed!"
+    print "----"
 
 def clone():
     for name, repo in repos.iteritems():