コード例 #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()