[Schevo-devel] new test style idea
Matthew Scott
mscott at springfieldtech.com
Mon Mar 13 16:26:20 EST 2006
While we are reducing test boilerplate, here is yet another revision for
perusal. The difference here is that there is no "db = self.db" at the
beginning of the test. Where does it get db from? The code in setUp()
and tearDown() set and delete self.db, but they also set 'db' in the
test class's module globals. :)
With this in place, we should be able to cut a wide swath of repetition
out of the way.
I think we should be conservative about magic that touches all tests,
but I think this is a useful scenario for it :)
class TestDatabase(CreatesSchema):
body = """
class Foo(E.Entity):
bar = f.string()
def t_create_foo():
return CreateFoo()
class CreateFoo(T.Transaction):
def _execute(self, db):
return db.execute(db.Foo.t.create(bar='baz'))
"""
def test_database_t_namespace(self):
tx = db.t.create_foo()
foo = db.execute(tx)
assert foo.bar == 'baz'
--
Matthew Scott
Springfield Technology
More information about the Schevo-devel
mailing list