From 487a26bcff3a9f07dd95934a91fe44ee5d04a34f Mon Sep 17 00:00:00 2001 From: kingbuzzman Date: Sat, 8 Jan 2022 12:58:45 -0500 Subject: [PATCH 01/14] Rebase --- behave_django/management/commands/behave.py | 18 ++++++++++++- requirements.txt | 2 +- tests/unit/test_cli.py | 30 +++++++++++++++++++++ 3 files changed, 48 insertions(+), 2 deletions(-) diff --git a/behave_django/management/commands/behave.py b/behave_django/management/commands/behave.py index 2182d96..611c8a7 100644 --- a/behave_django/management/commands/behave.py +++ b/behave_django/management/commands/behave.py @@ -2,6 +2,7 @@ import sys +from behave.configuration import options as behave_options, valid_python_module from behave.__main__ import main as behave_main from behave.configuration import options as behave_options from django.core.management.base import BaseCommand @@ -54,6 +55,12 @@ def add_command_arguments(parser): help="Use simple test runner that supports Django's" " testing client only (no web browser automation)" ) + parser.add_argument( + '--runner-class', + action='store', + type=valid_python_module, + help="" + ) def add_behave_arguments(parser): # noqa @@ -70,6 +77,7 @@ def add_behave_arguments(parser): # noqa '-v', '-S', '--simple', + '--runner-class', ] parser.add_argument( @@ -127,6 +135,12 @@ def handle(self, *args, **options): ' together with --use-existing-database' )) + if options['runner_class'] and (options['use_existing_database'] or options['simple']): + self.stderr.write(self.style.WARNING( + '--use-existing-database or --simple has no effect' + ' together with --runner-class' + )) + # Configure django environment passthru_args = ('failfast', 'interactive', @@ -136,7 +150,9 @@ def handle(self, *args, **options): k, v in options.items() if k in passthru_args and v is not None} - if options['dry_run'] or options['use_existing_database']: + if options['runner_class']: + django_test_runner = options['runner_class'](**runner_args) + elif options['dry_run'] or options['use_existing_database']: django_test_runner = ExistingDatabaseTestRunner(**runner_args) elif options['simple']: django_test_runner = SimpleTestRunner(**runner_args) diff --git a/requirements.txt b/requirements.txt index fd5cc61..dd0581f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ beautifulsoup4 -behave +#@git+http://github.com/behave/behave.git@v1.2.7.dev2#egg=behave # behave>=1.2.7 django>=2.2 diff --git a/tests/unit/test_cli.py b/tests/unit/test_cli.py index db37508..8011028 100644 --- a/tests/unit/test_cli.py +++ b/tests/unit/test_cli.py @@ -1,4 +1,5 @@ import os +import pytest from imp import reload from .util import DjangoSetupMixin, run_silently, show_run_error @@ -15,6 +16,7 @@ def test_additional_management_command_options(self): os.linesep) in output assert (os.linesep + ' -k, --keepdb') in output assert (os.linesep + ' -S, --simple') in output + assert (os.linesep + ' --runner-class') in output assert (os.linesep + ' --noinput, --no-input') in output assert (os.linesep + ' --failfast') in output assert (os.linesep + ' -r, --reverse') in output @@ -25,11 +27,15 @@ def test_should_accept_behave_arguments(self): args = command.get_behave_args( argv=['manage.py', 'behave', '--format', 'progress', + '--behave-runner-class', 'behave.runner.Runner', + '--runner-class', 'behave_django.runner.BehaviorDrivenTestRunner', '--settings', 'test_project.settings', '-i', 'some-pattern', 'features/running-tests.feature']) assert '--format' in args + assert '--runner-class' in args + assert args[args.index('--runner-class') + 1] == 'behave.runner.Runner' assert 'progress' in args assert '-i' in args assert 'some-pattern' in args @@ -107,3 +113,27 @@ def test_simple_and_use_existing_database_flags_raise_a_warning(self): '--simple flag has no effect together with ' '--use-existing-database' + os.linesep) in output + + @pytest.mark.parametrize('arguments, expect_error', [ + ('--runner-class behave_django.runner.BehaviorDrivenTestRunner', False), + ('--runner-class behave_django.runner.BehaviorDrivenTestRunner --simple', True), + ('--runner-class behave_django.runner.BehaviorDrivenTestRunner --use-existing-database', True), + ('--behave-runner-class behave.runner.Runner --simple', False), + ]) + def test_runner_class_and_others_flags_raise_a_warning(self, arguments, expect_error): + exit_status, output = run_silently( + 'python tests/manage.py behave' + ' %s --tags=@skip-all' % arguments + ) + assert exit_status == 0, \ + show_run_error(exit_status, output) + + warning_message = ( + os.linesep + + '--use-existing-database or --simple has no effect' + ' together with --runner-class' + + os.linesep) + if expect_error: + assert warning_message in output + else: + assert warning_message not in output From c2dd0e0c4b6b67480ba44d414ab6c082e8ed901d Mon Sep 17 00:00:00 2001 From: kingbuzzman Date: Mon, 10 Jan 2022 06:30:40 -0500 Subject: [PATCH 02/14] Fixes isort and flake8 issues. Adds docs --- HISTORY.rst | 2 + behave_django/management/commands/behave.py | 9 ++-- requirements.txt | 2 +- tests/unit/test_cli.py | 46 +++++++++++++++------ 4 files changed, 42 insertions(+), 17 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index c50549c..70f61b3 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -7,6 +7,8 @@ Release History **Features and Improvements** - Cover Python 3.9 and 3.10 and Django 3.2, drop Python 3.5 and Django 3.0 support +- Bump Behave requirement to 1.2.7 (allows option to change the Behave TestCase) +- Added option to change the Django TestCase 1.4.0 (2020-06-15) ++++++++++++++++++ diff --git a/behave_django/management/commands/behave.py b/behave_django/management/commands/behave.py index 611c8a7..9168841 100644 --- a/behave_django/management/commands/behave.py +++ b/behave_django/management/commands/behave.py @@ -2,9 +2,8 @@ import sys -from behave.configuration import options as behave_options, valid_python_module from behave.__main__ import main as behave_main -from behave.configuration import options as behave_options +from behave.configuration import options as behave_options, valid_python_module from django.core.management.base import BaseCommand from behave_django.environment import monkey_patch_behave @@ -59,7 +58,8 @@ def add_command_arguments(parser): '--runner-class', action='store', type=valid_python_module, - help="" + help=('Full Python dotted path to a package, module, Django TestCase. ' + ' Defaults to "behave_django.runner.BehaviorDrivenTestRunner".') ) @@ -135,7 +135,8 @@ def handle(self, *args, **options): ' together with --use-existing-database' )) - if options['runner_class'] and (options['use_existing_database'] or options['simple']): + both_active = options['use_existing_database'] or options['simple'] + if options['runner_class'] and both_active: self.stderr.write(self.style.WARNING( '--use-existing-database or --simple has no effect' ' together with --runner-class' diff --git a/requirements.txt b/requirements.txt index dd0581f..2d75887 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ beautifulsoup4 -#@git+http://github.com/behave/behave.git@v1.2.7.dev2#egg=behave # behave>=1.2.7 +behave@git+http://github.com/behave/behave.git@v1.2.7.dev2#egg=behave # behave>=1.2.7 django>=2.2 diff --git a/tests/unit/test_cli.py b/tests/unit/test_cli.py index 8011028..1d9f4ce 100644 --- a/tests/unit/test_cli.py +++ b/tests/unit/test_cli.py @@ -1,6 +1,6 @@ import os -import pytest from imp import reload +import pytest from .util import DjangoSetupMixin, run_silently, show_run_error @@ -24,14 +24,16 @@ def test_additional_management_command_options(self): def test_should_accept_behave_arguments(self): from behave_django.management.commands.behave import Command command = Command() - args = command.get_behave_args( - argv=['manage.py', 'behave', - '--format', 'progress', - '--behave-runner-class', 'behave.runner.Runner', - '--runner-class', 'behave_django.runner.BehaviorDrivenTestRunner', - '--settings', 'test_project.settings', - '-i', 'some-pattern', - 'features/running-tests.feature']) + argv = [ + 'manage.py', 'behave', + '--format', 'progress', + '--behave-runner-class', 'behave.runner.Runner', + '--runner-class', 'behave_django.runner.BehaviorDrivenTestRunner', + '--settings', 'test_project.settings', + '-i', 'some-pattern', + 'features/running-tests.feature' + ] + args = command.get_behave_args(argv=argv) assert '--format' in args assert '--runner-class' in args @@ -116,11 +118,31 @@ def test_simple_and_use_existing_database_flags_raise_a_warning(self): @pytest.mark.parametrize('arguments, expect_error', [ ('--runner-class behave_django.runner.BehaviorDrivenTestRunner', False), - ('--runner-class behave_django.runner.BehaviorDrivenTestRunner --simple', True), - ('--runner-class behave_django.runner.BehaviorDrivenTestRunner --use-existing-database', True), + ( + ( + '--runner-class behave_django.runner.BehaviorDrivenTestRunner ' + '--simple' + ), + True + ), + ( + ( + '--runner-class behave_django.runner.BehaviorDrivenTestRunner ' + '--use-existing-database' + ), + True + ), ('--behave-runner-class behave.runner.Runner --simple', False), + ( + ( + '--behave-runner-class behave.runner.Runner ' + '--runner-class behave_django.runner.BehaviorDrivenTestRunner' + ), + False + ), ]) - def test_runner_class_and_others_flags_raise_a_warning(self, arguments, expect_error): + def test_runner_class_and_others_flags_raise_a_warning(self, arguments, + expect_error): exit_status, output = run_silently( 'python tests/manage.py behave' ' %s --tags=@skip-all' % arguments From 85eba0f5e87773f7a8996308e794ba6629b93666 Mon Sep 17 00:00:00 2001 From: kingbuzzman Date: Mon, 10 Jan 2022 06:36:18 -0500 Subject: [PATCH 03/14] Fixes the outstanding isort issues. Fixes flake8 --- behave_django/management/commands/behave.py | 3 ++- docs/conf.py | 2 +- setup.py | 1 + tests/unit/test_cli.py | 6 +++++- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/behave_django/management/commands/behave.py b/behave_django/management/commands/behave.py index 9168841..836b898 100644 --- a/behave_django/management/commands/behave.py +++ b/behave_django/management/commands/behave.py @@ -3,7 +3,8 @@ import sys from behave.__main__ import main as behave_main -from behave.configuration import options as behave_options, valid_python_module +from behave.configuration import options as behave_options +from behave.configuration import valid_python_module from django.core.management.base import BaseCommand from behave_django.environment import monkey_patch_behave diff --git a/docs/conf.py b/docs/conf.py index a7c7bc7..c08f12e 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -12,9 +12,9 @@ # All configuration values have a default; values that are commented out # serve to show the default. -import sys import os import shlex +import sys sys.path.insert(0, os.path.abspath('..')) diff --git a/setup.py b/setup.py index e485b0f..d5bdfdb 100755 --- a/setup.py +++ b/setup.py @@ -4,6 +4,7 @@ """ from os import chdir from os.path import abspath, dirname, normpath + from setuptools import find_packages, setup # allow setup.py to be run from any path diff --git a/tests/unit/test_cli.py b/tests/unit/test_cli.py index 1d9f4ce..7627490 100644 --- a/tests/unit/test_cli.py +++ b/tests/unit/test_cli.py @@ -1,5 +1,6 @@ import os from imp import reload + import pytest from .util import DjangoSetupMixin, run_silently, show_run_error @@ -117,7 +118,10 @@ def test_simple_and_use_existing_database_flags_raise_a_warning(self): os.linesep) in output @pytest.mark.parametrize('arguments, expect_error', [ - ('--runner-class behave_django.runner.BehaviorDrivenTestRunner', False), + ( + '--runner-class behave_django.runner.BehaviorDrivenTestRunner', + False + ), ( ( '--runner-class behave_django.runner.BehaviorDrivenTestRunner ' From 57f83817c9835cd1e25fc0cb76de3a9db080bf22 Mon Sep 17 00:00:00 2001 From: Javier Buzzi Date: Mon, 10 Jan 2022 06:59:57 -0500 Subject: [PATCH 04/14] Update HISTORY.rst Co-authored-by: Peter Bittner --- HISTORY.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HISTORY.rst b/HISTORY.rst index 70f61b3..89a053f 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -8,7 +8,7 @@ Release History - Cover Python 3.9 and 3.10 and Django 3.2, drop Python 3.5 and Django 3.0 support - Bump Behave requirement to 1.2.7 (allows option to change the Behave TestCase) -- Added option to change the Django TestCase +- New option to change the Django TestCase 1.4.0 (2020-06-15) ++++++++++++++++++ From c538f1972f97a4e82a7198300e3233b77a2aa3ed Mon Sep 17 00:00:00 2001 From: kingbuzzman Date: Mon, 10 Jan 2022 07:41:14 -0500 Subject: [PATCH 05/14] Adds docs --- behave_django/management/commands/behave.py | 5 +++-- docs/configuration.rst | 8 ++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/behave_django/management/commands/behave.py b/behave_django/management/commands/behave.py index 836b898..43ddc07 100644 --- a/behave_django/management/commands/behave.py +++ b/behave_django/management/commands/behave.py @@ -59,8 +59,9 @@ def add_command_arguments(parser): '--runner-class', action='store', type=valid_python_module, - help=('Full Python dotted path to a package, module, Django TestCase. ' - ' Defaults to "behave_django.runner.BehaviorDrivenTestRunner".') + help=('Full Python dotted path to a package, module, Django ' + 'TestRunner. Defaults to ' + '"behave_django.runner.BehaviorDrivenTestRunner".') ) diff --git a/docs/configuration.rst b/docs/configuration.rst index c4d9421..7826456 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -38,6 +38,14 @@ after each scenario instead of flushing the entire database. Tests run much quicker, however HTTP server is not started and therefore web browser automation is not available. +``--runner-class`` +****************** + +Full Python dotted path to a package, module, Django TestRunner. + +_Not to be confused with `--behave-runner-class` that handles the internal +`TestRunner` inside `behave`._ + Behave configuration file ------------------------- From d2dc6187428d01a1585632899b619a8845838306 Mon Sep 17 00:00:00 2001 From: kingbuzzman Date: Mon, 10 Jan 2022 08:12:37 -0500 Subject: [PATCH 06/14] Makes BehaviorDrivenTestRunner the real default test runner --- behave_django/management/commands/behave.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/behave_django/management/commands/behave.py b/behave_django/management/commands/behave.py index 43ddc07..2df545d 100644 --- a/behave_django/management/commands/behave.py +++ b/behave_django/management/commands/behave.py @@ -59,9 +59,9 @@ def add_command_arguments(parser): '--runner-class', action='store', type=valid_python_module, + default='behave_django.runner.BehaviorDrivenTestRunner', help=('Full Python dotted path to a package, module, Django ' - 'TestRunner. Defaults to ' - '"behave_django.runner.BehaviorDrivenTestRunner".') + 'TestRunner. Defaults to "%(default)s)".') ) @@ -153,15 +153,14 @@ def handle(self, *args, **options): k, v in options.items() if k in passthru_args and v is not None} - if options['runner_class']: - django_test_runner = options['runner_class'](**runner_args) - elif 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_runner_class = options['runner_class'] + if django_runner_class is BehaviorDrivenTestRunner: + if options['dry_run'] or options['use_existing_database']: + django_runner_class = ExistingDatabaseTestRunner + elif options['simple']: + django_runner_class = SimpleTestRunner + django_test_runner = django_runner_class(**runner_args) django_test_runner.setup_test_environment() old_config = django_test_runner.setup_databases() From 5faf0d69874f991ea15bb5393298b43fcb786354 Mon Sep 17 00:00:00 2001 From: kingbuzzman Date: Mon, 10 Jan 2022 08:36:52 -0500 Subject: [PATCH 07/14] Reworks logic to keep it KISS, updates tests --- behave_django/management/commands/behave.py | 10 ++++++---- tests/unit/test_cli.py | 17 ++++++++++++++++- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/behave_django/management/commands/behave.py b/behave_django/management/commands/behave.py index 2df545d..998aa0a 100644 --- a/behave_django/management/commands/behave.py +++ b/behave_django/management/commands/behave.py @@ -130,6 +130,9 @@ def add_arguments(self, parser): def handle(self, *args, **options): + django_runner_class = options['runner_class'] + is_default_runner = django_runner_class is BehaviorDrivenTestRunner + # Check the flags if options['use_existing_database'] and options['simple']: self.stderr.write(self.style.WARNING( @@ -137,8 +140,8 @@ def handle(self, *args, **options): ' together with --use-existing-database' )) - both_active = options['use_existing_database'] or options['simple'] - if options['runner_class'] and both_active: + active_flags = options['use_existing_database'] or options['simple'] + if not is_default_runner and active_flags: self.stderr.write(self.style.WARNING( '--use-existing-database or --simple has no effect' ' together with --runner-class' @@ -153,8 +156,7 @@ def handle(self, *args, **options): k, v in options.items() if k in passthru_args and v is not None} - django_runner_class = options['runner_class'] - if django_runner_class is BehaviorDrivenTestRunner: + if is_default_runner: if options['dry_run'] or options['use_existing_database']: django_runner_class = ExistingDatabaseTestRunner elif options['simple']: diff --git a/tests/unit/test_cli.py b/tests/unit/test_cli.py index 7627490..7deed25 100644 --- a/tests/unit/test_cli.py +++ b/tests/unit/test_cli.py @@ -124,7 +124,7 @@ def test_simple_and_use_existing_database_flags_raise_a_warning(self): ), ( ( - '--runner-class behave_django.runner.BehaviorDrivenTestRunner ' + '--runner-class behave_django.runner.SimpleTestRunner ' '--simple' ), True @@ -132,6 +132,21 @@ def test_simple_and_use_existing_database_flags_raise_a_warning(self): ( ( '--runner-class behave_django.runner.BehaviorDrivenTestRunner ' + '--simple' + ), + False + ), + ( + ( + '--behave-runner-class behave.runner.Runner ' + '--runner-class behave_django.runner.SimpleTestRunner ' + '--simple' + ), + True + ), + ( + ( + '--runner-class behave_django.runner.SimpleTestRunner ' '--use-existing-database' ), True From 8daf9161ba8774d2191bfcedc79173857fb7ac3a Mon Sep 17 00:00:00 2001 From: kingbuzzman Date: Mon, 10 Jan 2022 08:41:44 -0500 Subject: [PATCH 08/14] Fixes broken tests due to incorrect path --- tests/unit/test_passthru_args.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/test_passthru_args.py b/tests/unit/test_passthru_args.py index 65f97d9..bfb3594 100644 --- a/tests/unit/test_passthru_args.py +++ b/tests/unit/test_passthru_args.py @@ -4,7 +4,7 @@ @mock.patch('behave_django.management.commands.behave.behave_main', return_value=0) # noqa -@mock.patch('behave_django.management.commands.behave.BehaviorDrivenTestRunner') # noqa +@mock.patch('behave_django.runner.BehaviorDrivenTestRunner') class TestPassThruArgs(DjangoSetupMixin): def test_keepdb_flag(self, From d0ca1c8b6c00879f46bf96248fe605aea54acae9 Mon Sep 17 00:00:00 2001 From: kingbuzzman Date: Mon, 10 Jan 2022 08:44:58 -0500 Subject: [PATCH 09/14] Fixes class name --- HISTORY.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HISTORY.rst b/HISTORY.rst index 89a053f..9d5146f 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -8,7 +8,7 @@ Release History - Cover Python 3.9 and 3.10 and Django 3.2, drop Python 3.5 and Django 3.0 support - Bump Behave requirement to 1.2.7 (allows option to change the Behave TestCase) -- New option to change the Django TestCase +- New option to change the Django TestRunner 1.4.0 (2020-06-15) ++++++++++++++++++ From 9b97acb375771dc536b220b30faf76e7662181bb Mon Sep 17 00:00:00 2001 From: Javier Buzzi Date: Mon, 10 Jan 2022 08:48:34 -0500 Subject: [PATCH 10/14] Update HISTORY.rst --- HISTORY.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HISTORY.rst b/HISTORY.rst index 9d5146f..128473e 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -7,7 +7,7 @@ Release History **Features and Improvements** - Cover Python 3.9 and 3.10 and Django 3.2, drop Python 3.5 and Django 3.0 support -- Bump Behave requirement to 1.2.7 (allows option to change the Behave TestCase) +- Bump Behave requirement to 1.2.7 (allows option to change the Behave TestRunner) - New option to change the Django TestRunner 1.4.0 (2020-06-15) From f5066961e98fb529d9f361a0ffc8ec2596b6af59 Mon Sep 17 00:00:00 2001 From: Javier Buzzi Date: Mon, 10 Jan 2022 09:11:05 -0500 Subject: [PATCH 11/14] Update configuration.rst --- docs/configuration.rst | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/configuration.rst b/docs/configuration.rst index 7826456..dac7378 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -30,14 +30,6 @@ recreating it each time you run the test. This flag enables ``manage.py behave --keepdb`` to take advantage of that feature. |keepdb docs|_. -``--simple`` -************ - -Use Django's simple ``TestCase`` which rolls back the database transaction -after each scenario instead of flushing the entire database. Tests run much -quicker, however HTTP server is not started and therefore web browser -automation is not available. - ``--runner-class`` ****************** @@ -46,6 +38,14 @@ Full Python dotted path to a package, module, Django TestRunner. _Not to be confused with `--behave-runner-class` that handles the internal `TestRunner` inside `behave`._ +``--simple`` +************ + +Use Django's simple ``TestCase`` which rolls back the database transaction +after each scenario instead of flushing the entire database. Tests run much +quicker, however HTTP server is not started and therefore web browser +automation is not available. + Behave configuration file ------------------------- From 9953961ab98051fa133977e684af0f009b2bc00a Mon Sep 17 00:00:00 2001 From: Javier Buzzi Date: Mon, 10 Jan 2022 09:32:20 -0500 Subject: [PATCH 12/14] Update configuration.rst --- docs/configuration.rst | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/configuration.rst b/docs/configuration.rst index dac7378..1c2072d 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -33,10 +33,11 @@ recreating it each time you run the test. This flag enables ``--runner-class`` ****************** -Full Python dotted path to a package, module, Django TestRunner. +Full Python dotted path to a package, module, Django TestRunner. -_Not to be confused with `--behave-runner-class` that handles the internal -`TestRunner` inside `behave`._ +Not to be confused with `--behave-runner-class` that handles the internal +`TestRunner` inside `behave`. You can read more about it in the +`_behave docs`_. ``--simple`` ************ @@ -68,4 +69,5 @@ In your ``.behaverc`` file, you can put .. |keepdb docs| replace:: More information about ``--keepdb`` .. _keepdb docs: https://docs.djangoproject.com/en/stable/topics/testing/overview/#the-test-database +.. __behave docs: https://behave.readthedocs.io/en/latest/behave.html#cmdoption-runner-class .. _behave docs: https://behave.readthedocs.io/en/latest/behave.html#configuration-files From 93c03decc048c8c7d379fef4414e9502a93e182f Mon Sep 17 00:00:00 2001 From: Javier Buzzi Date: Mon, 10 Jan 2022 09:42:32 -0500 Subject: [PATCH 13/14] Update configuration.rst --- docs/configuration.rst | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/configuration.rst b/docs/configuration.rst index 1c2072d..82a3b63 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -13,14 +13,6 @@ management command. Additional command line options provided by *behave-django*: -``--use-existing-database`` -*************************** - -Don't create a test database, and use the database of your default runserver -instead. USE AT YOUR OWN RISK! Only use this option for testing against a -*copy* of your production database or other valuable data. Your tests may -destroy your data irrecoverably. - ``--keepdb`` ************ @@ -47,6 +39,14 @@ after each scenario instead of flushing the entire database. Tests run much quicker, however HTTP server is not started and therefore web browser automation is not available. +``--use-existing-database`` +*************************** + +Don't create a test database, and use the database of your default runserver +instead. USE AT YOUR OWN RISK! Only use this option for testing against a +*copy* of your production database or other valuable data. Your tests may +destroy your data irrecoverably. + Behave configuration file ------------------------- From 468ea2669a357faf8bb0850a9895e3f4172c92db Mon Sep 17 00:00:00 2001 From: Javier Buzzi Date: Mon, 10 Jan 2022 09:56:50 -0500 Subject: [PATCH 14/14] Update configuration.rst --- docs/configuration.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/configuration.rst b/docs/configuration.rst index 82a3b63..b04b0b9 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -29,7 +29,7 @@ Full Python dotted path to a package, module, Django TestRunner. Not to be confused with `--behave-runner-class` that handles the internal `TestRunner` inside `behave`. You can read more about it in the -`_behave docs`_. +`behave docs `__. ``--simple`` ************ @@ -69,5 +69,4 @@ In your ``.behaverc`` file, you can put .. |keepdb docs| replace:: More information about ``--keepdb`` .. _keepdb docs: https://docs.djangoproject.com/en/stable/topics/testing/overview/#the-test-database -.. __behave docs: https://behave.readthedocs.io/en/latest/behave.html#cmdoption-runner-class .. _behave docs: https://behave.readthedocs.io/en/latest/behave.html#configuration-files