initial py.test removal.

if you want to test, you must now:
easy_install nose
nosetests
This commit is contained in:
percious17 2008-12-02 01:03:28 +00:00
parent fda8014cce
commit 1909dc8888
5 changed files with 44 additions and 19 deletions

View File

@ -31,7 +31,10 @@ class TestAddDropColumn(fixture.DB):
def tearDown(self):
super(TestAddDropColumn,self).tearDown()
if self.engine.has_table(self.table.name):
self.table.drop()
try:
self.table.drop()
except:
pass
self.meta.clear()
def run_(self,create_column_func,drop_column_func,*col_p,**col_k):

View File

@ -1,5 +1,6 @@
#import unittest
from py.test import raises
#from py.test import raises
from nose.tools import raises
class FakeTestCase(object):
"""Mimics unittest.testcase methods
@ -21,8 +22,23 @@ class FakeTestCase(object):
assert x == y
def assertNotEquals(self,x,y,doc=None):
assert x != y
def assertRaises(self,error,func,*p,**k):
assert raises(error,func,*p,**k)
def assertRaises(self, exceptions, func, *arg, **kw):
if not hasattr(exceptions, '__iter__'):
exceptions = (exceptions, )
valid = ' or '.join([e.__name__ for e in exceptions])
try:
func(*arg, **kw)
except exceptions:
pass
except:
raise
else:
message = "%s() did not raise %s" % (func.__name__, valid)
raise AssertionError(message)
#def assertRaises(self,error,func,*p,**k):
# assert raises(error,func,*p,**k)
def assertEqualsIgnoreWhitespace(self, v1, v2):
def createLines(s):

View File

@ -57,20 +57,25 @@ def usedb(supported=None,not_supported=None):
urls = DB.urls
urls = [url for url in urls if is_supported(url,supported,not_supported)]
def entangle(func):
def run(self,*p,**k):
def dec(func):
def entangle(self):
for url in urls:
def run_one():
self._connect(url)
self.setup_method(func)
try:
func(self,*p,**k)
finally:
self.teardown_method(func)
self._disconnect()
yield run_one
return run
return entangle
self._connect(url)
self.setup_method(func)
yield func, self
self._disconnect()
self.teardown_method(func)
#[self.setup_method(func)
#try:
# r = func(self)
#finally:
# self.teardown_method(func)
# self._disconnect()
#yield r
entangle.__name__ = func.__name__
return entangle
return dec
class DB(Base):
# Constants: connection level

View File

@ -1,4 +1,4 @@
from sqlalchemy import *
from sqlalchemy import select
from test import fixture
class TestConnect(fixture.DB):

View File

@ -31,6 +31,7 @@ class TestRepository(fixture.Pathed):
self.assert_(repos.config.get('db_settings','version_table'))
# version_table's default isn't none
self.assertNotEquals(repos.config.get('db_settings','version_table'),'None')
from nose.tools import raises
def test_load_notfound(self):
"""Nonexistant repositories shouldn't be loaded"""
@ -50,7 +51,7 @@ class TestRepository(fixture.Pathed):
class TestVersionedRepository(fixture.Pathed):
"""Tests on an existing repository with a single python script"""
script_cls = script.PythonScript
def setUp(self):
def setup(self):
Repository.clear()
self.path_repos=self.tmp_repos()
# Create repository, script