Skip to content

Instantly share code, notes, and snippets.

@jedp
Created February 14, 2012 19:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jedp/1829212 to your computer and use it in GitHub Desktop.
Save jedp/1829212 to your computer and use it in GitHub Desktop.
pyvows teardown not invoked unless all tests pass
from pyvows import Vows, expect
@Vows.batch
class IfATestFails(Vows.Context):
def topic(self):
return "oh noes!"
def setup(self):
print "test 1 setup: this will be printed"
def teardown(self):
print "test 2 teardown: this will not be printed - oh noes!"
def the_teardown_method_never_gets_called(self, topic):
expect(topic).to_equal(42)
@Vows.batch
class IfAllTestsPass(Vows.Context):
def topic(self):
return True
def setup(self):
print "test 2 setup: this will be printed"
def teardown(self):
print "test 2 teardown: this will be printed"
def the_teardown_method_gets_called(self, topic):
expect(topic).to_be_true()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment