def handle(self, *args, **options): behave_args = self.get_behave_args() # Configure django environment if options['dry_run'] or options['use_existing_database']: django_test_runner = ExistingDatabaseTestRunner() else: django_test_runner = BehaviorDrivenTestRunner() django_test_runner.setup_test_environment() if options['keepdb']: django_test_runner.keepdb = True old_config = django_test_runner.setup_databases() # Run Behave tests monkey_patch_behave(django_test_runner) exit_status = behave_main(args=behave_args) # Teardown django environment django_test_runner.teardown_databases(old_config) django_test_runner.teardown_test_environment() if exit_status != 0: sys.exit(exit_status)
def handle(self, *args, **options): # Check the flags if options['use_existing_database'] and options['simple']: self.stderr.write( self.style.WARNING('--simple flag has no effect' ' together with --use-existing-database')) # Configure django environment if options['dry_run'] or options['use_existing_database']: django_test_runner = ExistingDatabaseTestRunner() elif options['simple']: django_test_runner = SimpleTestRunner() else: django_test_runner = BehaviorDrivenTestRunner() django_test_runner.setup_test_environment() if options['keepdb']: django_test_runner.keepdb = True old_config = django_test_runner.setup_databases() # Run Behave tests monkey_patch_behave(django_test_runner) behave_args = self.get_behave_args() exit_status = behave_main(args=behave_args) # Teardown django environment django_test_runner.teardown_databases(old_config) django_test_runner.teardown_test_environment() if exit_status != 0: sys.exit(exit_status)
def handle(self, *args, **options): # Check the flags if options['use_existing_database'] and options['simple']: self.stderr.write(self.style.WARNING( '--simple flag has no effect' ' together with --use-existing-database' )) # Configure django environment if options['dry_run'] or options['use_existing_database']: django_test_runner = ExistingDatabaseTestRunner() elif options['simple']: django_test_runner = SimpleTestRunner() else: django_test_runner = BehaviorDrivenTestRunner() django_test_runner.setup_test_environment() if options['keepdb']: django_test_runner.keepdb = True old_config = django_test_runner.setup_databases() # Run Behave tests monkey_patch_behave(django_test_runner) behave_args = self.get_behave_args() exit_status = behave_main(args=behave_args) # Teardown django environment django_test_runner.teardown_databases(old_config) django_test_runner.teardown_test_environment() if exit_status != 0: sys.exit(exit_status)
def handle(self, *args, **options): # Check the flags if options["use_existing_database"] and options["simple"]: self.stderr.write( self.style.WARNING( "--simple flag has no effect" " together with --use-existing-database" ) ) # Configure django environment passthru_args = ("failfast", "interactive", "keepdb", "reverse") runner_args = { k: v for k, v in options.items() if k in passthru_args and v is not None } if options["dry_run"] or options["use_existing_database"]: django_test_runner = ExistingDatabaseTestRunner(**runner_args) elif options["simple"]: django_test_runner = SimpleTestRunner(**runner_args) else: BehaviorDrivenTestRunner.testcase_class.host = options["host"] BehaviorDrivenTestRunner.testcase_class.port = options["port"] django_test_runner = BehaviorDrivenTestRunner(**runner_args) django_test_runner.setup_test_environment() old_config = django_test_runner.setup_databases() # Run Behave tests monkey_patch_behave(django_test_runner) behave_args = self.get_behave_args() for app in apps.get_app_configs(): feature_dir = Path(app.path) / "features" if feature_dir.exists(): behave_args.append(feature_dir) behave_config = Configuration(behave_args) exit_status = run_behave(behave_config, runner_class=BehaveRunner) # Teardown django environment django_test_runner.teardown_databases(old_config) django_test_runner.teardown_test_environment() if exit_status != 0: sys.exit(exit_status)
def handle(self, *args, **options): django_test_runner = CloneExistingDatabaseTestRunner() django_test_runner.setup_test_environment() old_config = django_test_runner.setup_databases() # Run Behave tests monkey_patch_behave(django_test_runner) behave_args = self.get_behave_args() exit_status = behave_main(args=behave_args) # Teardown django environment django_test_runner.teardown_databases(old_config) django_test_runner.teardown_test_environment() if exit_status != 0: sys.exit(exit_status)
def handle(self, *args, **options): # Check the flags if options['use_existing_database'] and options['simple']: self.stderr.write(self.style.WARNING( '--simple flag has no effect' ' together with --use-existing-database' )) # Configure django environment passthru_args = ('failfast', 'interactive', 'keepdb', 'reverse') runner_args = {k: v for k, v in options.items() if k in passthru_args and v is not None} if options['dry_run'] or options['use_existing_database']: django_test_runner = ExistingDatabaseTestRunner(**runner_args) elif options['simple']: django_test_runner = SimpleTestRunner(**runner_args) else: django_test_runner = BehaviorDrivenTestRunner(**runner_args) django_test_runner.setup_test_environment() old_config = django_test_runner.setup_databases() # Run Behave tests monkey_patch_behave(django_test_runner) behave_args = self.get_behave_args() exit_status = behave_main(args=behave_args) # Teardown django environment django_test_runner.teardown_databases(old_config) django_test_runner.teardown_test_environment() if exit_status != 0: sys.exit(exit_status)
def handle(self, *args, **options): # Check the flags if options['use_existing_database'] and options['simple']: self.stderr.write( self.style.WARNING('--simple flag has no effect' ' together with --use-existing-database')) # Configure django environment passthru_args = ('failfast', 'interactive', 'keepdb', 'reverse') runner_args = { k: v for k, v in options.items() if k in passthru_args and v is not None } if options['dry_run'] or options['use_existing_database']: django_test_runner = ExistingDatabaseTestRunner(**runner_args) elif options['simple']: django_test_runner = SimpleTestRunner(**runner_args) else: django_test_runner = BehaviorDrivenTestRunner(**runner_args) django_test_runner.setup_test_environment() old_config = django_test_runner.setup_databases() # Run Behave tests monkey_patch_behave(django_test_runner) behave_args = self.get_behave_args() exit_status = behave_main(args=behave_args) # Teardown django environment django_test_runner.teardown_databases(old_config) django_test_runner.teardown_test_environment() if exit_status != 0: sys.exit(exit_status)