When I run "./manage.py behave flipr/features" command it runs the test with an empty step implementation but it raises an exception in django_test_runner.teardown_test(context) @ environment.py(110). Running django tests, however, is fine. Please let me know if you need any more information and any help is appreciated.
(venv) ➜ flipr git:(partnership) ✗ ./manage.py behave flipr/features
Creating test database for alias 'default'...
Feature: Partnership Tests # flipr/features/affiliate.feature:2
Scenario: Create a New Story with affiliate ID # flipr/features/affiliate.feature:3
Given We access the endpoint "/plans/?affiliateId=1" # flipr/features/steps/steps.py:7 0.000s
Exception IntegrityError: FOREIGN KEY constraint failed
Traceback (most recent call last):
File "/Users/fnegarestan/Documents/GitHub/flipr/venv/lib/python3.7/site-packages/django/db/backends/base/base.py", line 239, in _commit
return self.connection.commit()
sqlite3.IntegrityError: FOREIGN KEY constraint failed
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "./manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "/Users/fnegarestan/Documents/GitHub/flipr/venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
utility.execute()
File "/Users/fnegarestan/Documents/GitHub/flipr/venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/fnegarestan/Documents/GitHub/flipr/venv/lib/python3.7/site-packages/django/core/management/base.py", line 316, in run_from_argv
self.execute(*args, **cmd_options)
File "/Users/fnegarestan/Documents/GitHub/flipr/venv/lib/python3.7/site-packages/django/core/management/base.py", line 353, in execute
output = self.handle(*args, **options)
File "/Users/fnegarestan/Documents/GitHub/flipr/venv/lib/python3.7/site-packages/behave_django/management/commands/behave.py", line 128, in handle
exit_status = behave_main(args=behave_args)
File "/Users/fnegarestan/Documents/GitHub/flipr/venv/lib/python3.7/site-packages/behave/__main__.py", line 183, in main
return run_behave(config)
File "/Users/fnegarestan/Documents/GitHub/flipr/venv/lib/python3.7/site-packages/behave/__main__.py", line 127, in run_behave
failed = runner.run()
File "/Users/fnegarestan/Documents/GitHub/flipr/venv/lib/python3.7/site-packages/behave/runner.py", line 804, in run
return self.run_with_paths()
File "/Users/fnegarestan/Documents/GitHub/flipr/venv/lib/python3.7/site-packages/behave/runner.py", line 824, in run_with_paths
return self.run_model()
File "/Users/fnegarestan/Documents/GitHub/flipr/venv/lib/python3.7/site-packages/behave/runner.py", line 626, in run_model
failed = feature.run(self)
File "/Users/fnegarestan/Documents/GitHub/flipr/venv/lib/python3.7/site-packages/behave/model.py", line 321, in run
failed = scenario.run(runner)
File "/Users/fnegarestan/Documents/GitHub/flipr/venv/lib/python3.7/site-packages/behave/model.py", line 758, in run
runner.run_hook("after_scenario", runner.context, self)
File "/Users/fnegarestan/Documents/GitHub/flipr/venv/lib/python3.7/site-packages/behave_django/environment.py", line 110, in run_hook
django_test_runner.teardown_test(context)
File "/Users/fnegarestan/Documents/GitHub/flipr/venv/lib/python3.7/site-packages/behave_django/environment.py", line 87, in teardown_test
context.test._post_teardown(run=True)
File "/Users/fnegarestan/Documents/GitHub/flipr/venv/lib/python3.7/site-packages/behave_django/testcase.py", line 20, in _post_teardown
super(BehaviorDrivenTestMixin, self)._post_teardown()
File "/Users/fnegarestan/Documents/GitHub/flipr/venv/lib/python3.7/site-packages/django/test/testcases.py", line 908, in _post_teardown
self._fixture_teardown()
File "/Users/fnegarestan/Documents/GitHub/flipr/venv/lib/python3.7/site-packages/django/test/testcases.py", line 943, in _fixture_teardown
inhibit_post_migrate=inhibit_post_migrate)
File "/Users/fnegarestan/Documents/GitHub/flipr/venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 148, in call_command
return command.execute(*args, **defaults)
File "/Users/fnegarestan/Documents/GitHub/flipr/venv/lib/python3.7/site-packages/django/core/management/base.py", line 353, in execute
output = self.handle(*args, **options)
File "/Users/fnegarestan/Documents/GitHub/flipr/venv/lib/python3.7/site-packages/django/core/management/commands/flush.py", line 80, in handle
emit_post_migrate_signal(verbosity, interactive, database)
File "/Users/fnegarestan/Documents/GitHub/flipr/venv/lib/python3.7/site-packages/django/core/management/sql.py", line 51, in emit_post_migrate_signal
**kwargs
File "/Users/fnegarestan/Documents/GitHub/flipr/venv/lib/python3.7/site-packages/django/dispatch/dispatcher.py", line 175, in send
for receiver in self._live_receivers(sender)
File "/Users/fnegarestan/Documents/GitHub/flipr/venv/lib/python3.7/site-packages/django/dispatch/dispatcher.py", line 175, in <listcomp>
for receiver in self._live_receivers(sender)
File "/Users/fnegarestan/Documents/GitHub/flipr/venv/lib/python3.7/site-packages/django/contrib/auth/management/__init__.py", line 79, in create_permissions
Permission.objects.using(using).bulk_create(perms)
File "/Users/fnegarestan/Documents/GitHub/flipr/venv/lib/python3.7/site-packages/django/db/models/query.py", line 471, in bulk_create
obj_without_pk._state.db = self.db
File "/Users/fnegarestan/Documents/GitHub/flipr/venv/lib/python3.7/site-packages/django/db/transaction.py", line 212, in __exit__
connection.commit()
File "/Users/fnegarestan/Documents/GitHub/flipr/venv/lib/python3.7/site-packages/django/db/backends/base/base.py", line 261, in commit
self._commit()
File "/Users/fnegarestan/Documents/GitHub/flipr/venv/lib/python3.7/site-packages/django/db/backends/base/base.py", line 239, in _commit
return self.connection.commit()
File "/Users/fnegarestan/Documents/GitHub/flipr/venv/lib/python3.7/site-packages/django/db/utils.py", line 89, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/Users/fnegarestan/Documents/GitHub/flipr/venv/lib/python3.7/site-packages/django/db/backends/base/base.py", line 239, in _commit
return self.connection.commit()
django.db.utils.IntegrityError: FOREIGN KEY constraint failed
Feature: Partnership Tests
Scenario: Create a New Story with affiliate ID
Given We access the endpoint "/plans/?affiliateId=1"
from behave import *
@given('We access the endpoint "{url}"')
def step_impl(context, url):
pass