+ def setup_databases(self, *args, **kwargs):
+ """Fire up the db cluster, then punt to original implementation."""
+ process = Popen(['bin/maasdb', 'start', './db/'])
+ retval = process.wait()
+ if retval != 0:
+ raise RuntimeError("Failed to start database cluster.")
Consider subprocess.check_call() here; it'll raise CalledProcessError
if the command does not exit with 0. Four lines into one:
check_call(['bin/maasdb', 'start', './db/'])
It would also be nice to make this quiet unless there's an
error. Django doesn't seem to know about subunit output yet, but it
would be nice not to muddy things in advance. Witness how long it has
taken to make the Launchpad test suite STFU.
This is a neat solution :)
[1]
+ def setup_databases (self, *args, **kwargs): 'bin/maasdb' , 'start', './db/']) "Failed to start database cluster.")
+ """Fire up the db cluster, then punt to original implementation."""
+ process = Popen([
+ retval = process.wait()
+ if retval != 0:
+ raise RuntimeError(
Consider subprocess. check_call( ) here; it'll raise CalledProcessError
if the command does not exit with 0. Four lines into one:
It would also be nice to make this quiet unless there's an
error. Django doesn't seem to know about subunit output yet, but it
would be nice not to muddy things in advance. Witness how long it has
taken to make the Launchpad test suite STFU.
[2]
class SimpleTest( TestCase) : addition( self): create_ nodes(self) : l([], list(Node. objects. all())) l([n], list(Node. objects. all())) nodes_exist_ initially( self): l([], list(Node. objects. all()))
- def test_basic_
- """
- Tests that 1 + 1 always equals 2.
- """
- self.assertEqual(1 + 1, 2)
+
+ def test_can_
+ self.assertEqua
+ n = Node(name='foo', status='NEW')
+ n.save()
+ self.assertEqua
+
+ def test_no_
+ self.assertEqua
+
Raphael's recent changes provide enough to exercise your change, so
consider removing this.