diff options
author | Jason Kirtland <jek@discorporate.us> | 2008-01-12 22:03:42 +0000 |
---|---|---|
committer | Jason Kirtland <jek@discorporate.us> | 2008-01-12 22:03:42 +0000 |
commit | 17d3c8764e020379e54053bca0b0a2bc71d48aa0 (patch) | |
tree | 0b46f1ddc57292b8f5bfbc28ab1679230f63e426 /test/zblog/tests.py | |
parent | c194962019d1bc7322e20b82c33aa1bab3bc2a28 (diff) | |
download | sqlalchemy-17d3c8764e020379e54053bca0b0a2bc71d48aa0.tar.gz |
- testbase is gone, replaced by testenv
- Importing testenv has no side effects- explicit functions provide similar behavior to the old immediate behavior of testbase
- testing.db has the configured db
- Fixed up the perf/* scripts
Diffstat (limited to 'test/zblog/tests.py')
-rw-r--r-- | test/zblog/tests.py | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/test/zblog/tests.py b/test/zblog/tests.py index 359e8370b..066473085 100644 --- a/test/zblog/tests.py +++ b/test/zblog/tests.py @@ -1,5 +1,4 @@ -import testbase - +import testenv; testenv.configure_for_tests() from sqlalchemy import * from sqlalchemy.orm import * from testlib import * @@ -11,11 +10,11 @@ from zblog.blog import * class ZBlogTest(AssertMixin): def create_tables(self): - tables.metadata.drop_all(bind=testbase.db) - tables.metadata.create_all(bind=testbase.db) + tables.metadata.drop_all(bind=testing.db) + tables.metadata.create_all(bind=testing.db) def drop_tables(self): - tables.metadata.drop_all(bind=testbase.db) - + tables.metadata.drop_all(bind=testing.db) + def setUpAll(self): self.create_tables() def tearDownAll(self): @@ -31,7 +30,7 @@ class SavePostTest(ZBlogTest): super(SavePostTest, self).setUpAll() mappers.zblog_mappers() global blog_id, user_id - s = create_session(bind=testbase.db) + s = create_session(bind=testing.db) user = User('zbloguser', "Zblog User", "hello", group=administrator) blog = Blog(owner=user) blog.name = "this is a blog" @@ -45,12 +44,12 @@ class SavePostTest(ZBlogTest): def tearDownAll(self): clear_mappers() super(SavePostTest, self).tearDownAll() - + def testattach(self): """test that a transient/pending instance has proper bi-directional behavior. - + this requires that lazy loaders do not fire off for a transient/pending instance.""" - s = create_session(bind=testbase.db) + s = create_session(bind=testing.db) s.begin() try: @@ -62,12 +61,12 @@ class SavePostTest(ZBlogTest): assert post in blog.posts finally: s.rollback() - + def testoptimisticorphans(self): - """test that instances in the session with un-loaded parents will not + """test that instances in the session with un-loaded parents will not get marked as "orphans" and then deleted """ - s = create_session(bind=testbase.db) - + s = create_session(bind=testing.db) + s.begin() try: blog = s.query(Blog).get(blog_id) @@ -87,14 +86,12 @@ class SavePostTest(ZBlogTest): comment.user = user s.flush() s.clear() - + assert s.query(Post).get(post.id) is not None - + finally: s.rollback() - - -if __name__ == "__main__": - testbase.main() - + +if __name__ == "__main__": + testenv.main() |