예제 #1
0
파일: harvest.py 프로젝트: nailor/lettuce
        registry.call_hook("before", "harvest", locals())
        results = []
        try:
            for path in paths:
                app_module = None
                if isinstance(path, tuple) and len(path) is 2:
                    path, app_module = path

                if app_module is not None:
                    registry.call_hook("before_each", "app", app_module)

                runner = Runner(path, options.get("scenarios"), verbosity)
                result = runner.run()
                if app_module is not None:
                    registry.call_hook("after_each", "app", app_module, result)

                results.append(result)
                if not result or result.steps != result.steps_passed:
                    failed = True

        except Exception, e:
            import traceback

            traceback.print_exc(e)

        finally:
            registry.call_hook("after", "harvest", results)
            server.stop(failed)
            teardown_test_environment()
예제 #2
0
                app_module = None
                if isinstance(path, tuple) and len(path) is 2:
                    path, app_module = path

                if app_module is not None:
                    registry.call_hook('before_each', 'app', app_module)

                runner = Runner(path, options.get('scenarios'), verbosity,
                                enable_xunit=options.get('enable_xunit'),
                                xunit_filename=options.get('xunit_file'),
                                wait=wait)
                result = runner.run()
                if app_module is not None:
                    registry.call_hook('after_each', 'app', app_module, result)

                results.append(result)
                if not result or result.steps != result.steps_passed:
                    failed = True
        except SystemExit, e:
            exit_code = e.code
        except Exception, e:
            import traceback
            traceback.print_exc(e)

        finally:
            registry.call_hook('after', 'harvest', results)
            teardown_test_environment()
            if failed and exit_code == 0:
                exit_code = 1
            server.stop(exit_code)
예제 #3
0
파일: harvest.py 프로젝트: rstrobl/lettuce
                if app_module is not None:
                    registry.call_hook("before_each", "app", app_module)

                runner = Runner(path, options.get("scenarios"), verbosity)
                result = runner.run()
                if app_module is not None:
                    registry.call_hook("after_each", "app", app_module, result)

                results.append(result)
                if not result or result.steps != result.steps_passed:
                    failed = True

        except Exception, e:
            import traceback

            traceback.print_exc(e)

        finally:
            registry.call_hook("after", "harvest", results)

            if run_server:
                server.stop()

            if use_test_database:
                connection.creation.destroy_test_db(test_database, verbosity=1)

            teardown_test_environment()

            return sys.exit(0)
예제 #4
0
파일: harvest.py 프로젝트: thedrow/lettuce
        registry.call_hook('before', 'harvest', locals())
        results = []
        try:
            for path in paths:
                app_module = None
                if isinstance(path, tuple) and len(path) is 2:
                    path, app_module = path

                if app_module is not None:
                    registry.call_hook('before_each', 'app', app_module)

                runner = Runner(path, options.get('scenarios'), verbosity,
                                enable_xunit=options.get('enable_xunit'),
                                xunit_filename=options.get('xunit_file'))
                result = runner.run()
                if app_module is not None:
                    registry.call_hook('after_each', 'app', app_module, result)

                results.append(result)
                if not result or result.steps != result.steps_passed:
                    failed = True

        except Exception, e:
            import traceback
            traceback.print_exc(e)

        finally:
            registry.call_hook('after', 'harvest', results)
            server.stop(failed)
            teardown_test_environment()