Improving test discovery and coverage options.

This commit is contained in:
Ryan Petrello
2012-03-07 12:04:40 -05:00
parent a0186eafd9
commit 6d098bb5ab
10 changed files with 22 additions and 12 deletions

View File

@@ -1,2 +0,0 @@
[run]
omit = pecan/commands/*.py, pecan/templates/__init__.py, pecan/testing.py

View File

@@ -943,7 +943,7 @@ class TestLogging(TestCase):
assert len(writes) == 1 assert len(writes) == 1
class TestEngines(object): class TestEngines(TestCase):
template_path = os.path.join(os.path.dirname(__file__), 'templates') template_path = os.path.join(os.path.dirname(__file__), 'templates')

View File

@@ -1,4 +1,5 @@
from pecan import Pecan, expose, request, response, redirect from pecan import Pecan, expose, request, response, redirect
from unittest import TestCase
from webtest import TestApp from webtest import TestApp
try: try:
from simplejson import dumps from simplejson import dumps
@@ -6,7 +7,7 @@ except:
from json import dumps from json import dumps
class TestGeneric(object): class TestGeneric(TestCase):
def test_simple_generic(self): def test_simple_generic(self):
class RootController(object): class RootController(object):

View File

@@ -5,11 +5,12 @@ from pecan.hooks import PecanHook, TransactionHook, HookController, Requ
from pecan.configuration import Config from pecan.configuration import Config
from pecan.decorators import transactional, after_commit, after_rollback from pecan.decorators import transactional, after_commit, after_rollback
from copy import copy from copy import copy
from unittest import TestCase
from formencode import Schema, validators from formencode import Schema, validators
from webtest import TestApp from webtest import TestApp
class TestHooks(object): class TestHooks(TestCase):
def test_basic_single_hook(self): def test_basic_single_hook(self):
run_hook = [] run_hook = []
@@ -446,7 +447,7 @@ class TestHooks(object):
assert run_hook[5] == 'inside' assert run_hook[5] == 'inside'
assert run_hook[6] == 'after' assert run_hook[6] == 'after'
class TestTransactionHook(object): class TestTransactionHook(TestCase):
def test_transaction_hook(self): def test_transaction_hook(self):
run_hook = [] run_hook = []
@@ -1109,7 +1110,7 @@ class TestTransactionHook(object):
assert run_hook[3] == 'clear' assert run_hook[3] == 'clear'
class TestRequestViewerHook(object): class TestRequestViewerHook(TestCase):
def test_hook_from_config(self): def test_hook_from_config(self):
from pecan.configuration import _runtime_conf as conf from pecan.configuration import _runtime_conf as conf

View File

@@ -48,7 +48,7 @@ def test_simple_rule():
assert len(result) == 1 assert len(result) == 1
class TestJsonify(object): class TestJsonify(TestCase):
def test_simple_jsonify(self): def test_simple_jsonify(self):
Person = make_person() Person = make_person()

View File

@@ -1,5 +1,6 @@
from pecan import abort, expose, make_app, request, response from pecan import abort, expose, make_app, request, response
from pecan.rest import RestController from pecan.rest import RestController
from unittest import TestCase
from webtest import TestApp from webtest import TestApp
try: try:
from simplejson import dumps, loads from simplejson import dumps, loads
@@ -9,7 +10,7 @@ except:
import formencode import formencode
class TestRestController(object): class TestRestController(TestCase):
def test_basic_rest(self): def test_basic_rest(self):

View File

@@ -9,7 +9,7 @@ try:
except: except:
from sets import Set as set from sets import Set as set
class TestSecure(object): class TestSecure(TestCase):
def test_simple_secure(self): def test_simple_secure(self):
authorized = False authorized = False

View File

@@ -1,8 +1,9 @@
import os import os
from pecan import expose, make_app from pecan import expose, make_app
from unittest import TestCase
from webtest import TestApp from webtest import TestApp
class TestStatic(object): class TestStatic(TestCase):
def test_simple_static(self): def test_simple_static(self):
class RootController(object): class RootController(object):

View File

@@ -1,5 +1,6 @@
from formencode import ForEach, Schema, validators from formencode import ForEach, Schema, validators
from webtest import TestApp from webtest import TestApp
from unittest import TestCase
import os.path import os.path
@@ -12,7 +13,7 @@ except ImportError:
from json import dumps from json import dumps
class TestValidation(object): class TestValidation(TestCase):
template_path = os.path.join(os.path.dirname(__file__), 'templates') template_path = os.path.join(os.path.dirname(__file__), 'templates')

View File

@@ -1,3 +1,10 @@
[nosetests]
match=^test
where=pecan
nocapture=1
cover-package=pecan
cover-erase=1
[egg_info] [egg_info]
tag_build = dev tag_build = dev
tag_svn_revision = true tag_svn_revision = true