Merge lp://staging/~bjornt/launchpad/bug-432040 into lp://staging/launchpad

Proposed by Björn Tillenius
Status: Merged
Merged at revision: not available
Proposed branch: lp://staging/~bjornt/launchpad/bug-432040
Merge into: lp://staging/launchpad
Diff against target: None lines
To merge this branch: bzr merge lp://staging/~bjornt/launchpad/bug-432040
Reviewer Review Type Date Requested Status
Guilherme Salgado (community) Approve
Review via email: mp+12047@code.staging.launchpad.net
To post a comment you must log in.
Revision history for this message
Björn Tillenius (bjornt) wrote :

Make sure that the DB is reset between Windmill tests.

It turned out that this is already the case, so all I've done is to add
a tests to make sure it won't regress.

--
Björn Tillenius | https://launchpad.net/~bjornt

Revision history for this message
Guilherme Salgado (salgado) wrote :

Looks good to me, but you could use lp.testing.TestCase instead of unittest.TestCase as the former has some extra goodies, specially when reporting failures.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'lib/canonical/testing/tests/test_layers.py'
2--- lib/canonical/testing/tests/test_layers.py 1970-01-01 00:00:00 +0000
3+++ lib/canonical/testing/tests/test_layers.py 2009-09-18 11:57:13 +0000
4@@ -0,0 +1,28 @@
5+# Copyright 2009 Canonical Ltd. This software is licensed under the
6+# GNU Affero General Public License version 3 (see the file LICENSE).
7+
8+"""Tests for test layers."""
9+
10+__metaclass__ = type
11+__all__ = []
12+
13+import unittest
14+
15+from canonical.testing.layers import BaseWindmillLayer, DatabaseLayer
16+
17+
18+class TestBaseWindmillLayer(unittest.TestCase):
19+
20+ layer_to_test = BaseWindmillLayer
21+
22+ def test_db_reset_between_tests(self):
23+ # The db is reset between tests when DatabaseLayer layer's
24+ # testSetUp is called, if _reset_between_tests is True.
25+ self.assertTrue(
26+ issubclass(self.layer_to_test, DatabaseLayer))
27+ self.assertTrue(self.layer_to_test._reset_between_tests)
28+
29+
30+
31+def test_suite():
32+ return unittest.TestLoader().loadTestsFromName(__name__)