Skip to content

Issues with tests when using mongodb #18

@chelis

Description

@chelis

Using version 1.6.8 I get the following error when running tests

Traceback (most recent call last):
File "/home/chelis/development/python/Envs/UnifiedPatents/local/lib/python2.7/site-packages/django/test/testcases.py", line 187, in call
self._post_teardown()
File "/home/chelis/development/python/Envs/UnifiedPatents/local/lib/python2.7/site-packages/django/test/testcases.py", line 796, in _post_teardown
self._fixture_teardown()
File "/home/chelis/development/python/Envs/UnifiedPatents/local/lib/python2.7/site-packages/django/test/testcases.py", line 889, in _fixture_teardown
return super(TestCase, self)._fixture_teardown()
File "/home/chelis/development/python/Envs/UnifiedPatents/local/lib/python2.7/site-packages/django/test/testcases.py", line 817, in _fixture_teardown
inhibit_post_syncdb=self.available_apps is not None)
File "/home/chelis/development/python/Envs/UnifiedPatents/local/lib/python2.7/site-packages/django/core/management/init.py", line 159, in call_command
return klass.execute(_args, *_defaults)
File "/home/chelis/development/python/Envs/UnifiedPatents/local/lib/python2.7/site-packages/django/core/management/base.py", line 285, in execute
output = self.handle(_args, *_options)
File "/home/chelis/development/python/Envs/UnifiedPatents/local/lib/python2.7/site-packages/django/core/management/base.py", line 415, in handle
return self.handle_noargs(**options)
File "/home/chelis/development/python/Envs/UnifiedPatents/local/lib/python2.7/site-packages/django/core/management/commands/flush.py", line 79, in handle_noargs
six.reraise(CommandError, CommandError(new_msg), sys.exc_info()[2])
File "/home/chelis/development/python/Envs/UnifiedPatents/local/lib/python2.7/site-packages/django/core/management/commands/flush.py", line 67, in handle_noargs
savepoint=connection.features.can_rollback_ddl):
File "/home/chelis/development/python/Envs/UnifiedPatents/local/lib/python2.7/site-packages/django/db/transaction.py", line 251, in enter
"The outermost 'atomic' block cannot use "
CommandError: Database test_patent_litigation couldn't be flushed. Possible reasons:

  • The database isn't running or isn't configured correctly.
  • At least one of the expected database tables doesn't exist.
  • The SQL was invalid.
    Hint: Look at the output of 'django-admin.py sqlflush'. That's the SQL this command wasn't able to run.
    The full error: The outermost 'atomic' block cannot use savepoint = False when autocommit is off.

according to this post http://stackoverflow.com/questions/28520599/django-nonrel-mongodb-error-while-running-tests it runs with 1.5. Looking at djangos doc, 1.6 changed transaction behavior

https://docs.djangoproject.com/en/1.6/topics/db/transactions/

Changed in Django 1.6:
Before Django 1.6, autocommit was turned off, and it was emulated by forcing a commit after write operations in the ORM.

So I guess that's the reason of this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions