Exemple #1
0
 def spec(world):
     example_suite = ExampleSuite()
     ExampleSuite.set_suite(example_suite)
     with describe('Example Group with examples added by it()') as eg:
         decorator = it('Example description created by it()')
         example = decorator(first_test_function)
         assert eg.examples == [example]
Exemple #2
0
def main():
    formatter = ProgressFormatter(sys.stdout)
    reporter = Reporter(formatter)
    runner = Runner(reporter)
    suite = ExampleSuite.get_suite()

    return runner.run(suite, sys.argv[1])
Exemple #3
0
 def b(w):
     def failing_test_function(self):
         assert False
     def error_test_function(self):
         raise KeyError('grrr')
     example_suite = ExampleSuite()
     example_group = example_suite.add_example_group('reports')
     w.ex1 = Example('All good', first_test_function)
     w.ex2 = Example('Fail', failing_test_function)
     w.ex3 = Example('Error', error_test_function)
     example_group.add_example(w.ex1)
     example_group.add_example(w.ex2)
     example_group.add_example(w.ex3)
     io = StringIO()
     w.mock_formatter = MockFormatter()
     w.reporter = Reporter(w.mock_formatter)
     example_suite.run(w.reporter)
Exemple #4
0
def _get_current_example_group():
    return ExampleSuite.get_suite().get_current_example_group()
Exemple #5
0
 def s(w):
     ExampleSuite.set_suite(w.suite)
     assert ExampleSuite.get_suite() is w.suite
Exemple #6
0
 def s(w):
     assert type(ExampleSuite.get_suite()) is ExampleSuite
     assert ExampleSuite.get_suite() is ExampleSuite.get_suite()
Exemple #7
0
 def collect_to(self, example_suite):
     ExampleSuite.set_suite(example_suite)
     self.import_spec_files()