summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKevin Kubasik <kevin@kubasik.net>2009-07-22 13:12:26 +0000
committerKevin Kubasik <kevin@kubasik.net>2009-07-22 13:12:26 +0000
commitafa7b39d6ffa7389585cdbeec0c161a061b44961 (patch)
treeb4edd5cebcd250681d857a144283c4aac05de0a4 /tests
parent2511eb2759097be51a3cf255762cbc1dca2f1c08 (diff)
downloaddjango-afa7b39d6ffa7389585cdbeec0c161a061b44961.tar.gz
[gsoc2009-testing] Finally fixed the coverage issue by tracing all imports to a file, then loading on test run. Also, this has a copy of the python twill runner, still working on the DSL version
git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/test-improvements@11294 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
-rw-r--r--tests/regressiontests/admin_views/windmilltests/primary.py8
-rwxr-xr-xtests/runtests.py17
2 files changed, 17 insertions, 8 deletions
diff --git a/tests/regressiontests/admin_views/windmilltests/primary.py b/tests/regressiontests/admin_views/windmilltests/primary.py
index 9c2ff67d64..3b074239bc 100644
--- a/tests/regressiontests/admin_views/windmilltests/primary.py
+++ b/tests/regressiontests/admin_views/windmilltests/primary.py
@@ -27,7 +27,7 @@ def test_loginAndSetup():
client.asserts.assertNode(link=u'Change')
client.asserts.assertNode(link=u'Admin_Views')
client.asserts.assertNode(xpath=u"//div[@id='user-tools']/strong")
- client.click(xpath=u"//div[@id='content-main']/div/table/tbody/tr[22]/td/a")
+ client.click(xpath=u"//div[@id='content-main']/div/table/tbody/tr[23]/td/a")
client.waits.forPageLoad(timeout=u'20000')
client.type(text=u'Test Section', id=u'id_name')
client.click(name=u'_save')
@@ -324,15 +324,15 @@ def test_parentChildRelationship():
client.open(url=ADMIN_URL)
client.waits.forPageLoad(timeout=u'20000')
- client.waits.forElement(xpath=u"//div[@id='content-main']/div/table/tbody/tr[21]/td/a", timeout=u'8000')
- client.click(xpath=u"//div[@id='content-main']/div/table/tbody/tr[21]/td/a")
+ client.waits.forElement(xpath=u"//div[@id='content-main']/div/table/tbody/tr[22]/td/a", timeout=u'8000')
+ client.click(xpath=u"//div[@id='content-main']/div/table/tbody/tr[22]/td/a")
client.click(name=u'_save')
client.waits.forPageLoad(timeout=u'20000')
client.click(link=u'Recommender object')
client.waits.forPageLoad(timeout=u'20000')
client.click(link=u'Home')
client.waits.forPageLoad(timeout=u'20000')
- client.click(xpath=u"//div[@id='content-main']/div/table/tbody/tr[20]/td/a")
+ client.click(xpath=u"//div[@id='content-main']/div/table/tbody/tr[21]/td/a")
client.click(id=u'id_recommender')
client.select(option=u'Recommender object', id=u'id_recommender')
client.click(value=u'1')
diff --git a/tests/runtests.py b/tests/runtests.py
index 47a4847a7f..d9332ff66d 100755
--- a/tests/runtests.py
+++ b/tests/runtests.py
@@ -1,4 +1,14 @@
#!/usr/bin/env python
+try:
+ import coverage
+ global _dj_cover
+ _dj_cover = coverage.coverage(cover_pylib=True, auto_data=True)
+ _dj_cover.erase()
+ _dj_cover.use_cache(True)
+ _dj_cover.start()
+except Exception, e:
+ print "coverage.py module not available"
+
import os, sys, traceback
import unittest
import django
@@ -11,10 +21,7 @@ try:
except NameError:
from sets import Set as set # For Python 2.3
-try:
- import coverage
-except Exception, e:
- print "coverage.py module not available"
+
CONTRIB_DIR_NAME = 'django.contrib'
MODEL_TESTS_DIR_NAME = 'modeltests'
@@ -202,6 +209,8 @@ def django_tests(verbosity, interactive, test_labels):
#Run the appropriate test runner based on command line params.
if do_std:
if do_coverage:
+ _dj_cover.save()
+ _dj_cover.stop()
test_runner = get_runner(settings, coverage=True, reports=True)
else:
test_runner = get_runner(settings, coverage=False, reports=False)