peterbe / django-mongokit

Bridging Django to MongoDB with the MongoKit ODM (Object Document Mapper)
Other
122 stars 20 forks source link

Compatibility fix for Django 1.5 tests #14

Closed nickzam closed 11 years ago

nickzam commented 11 years ago

Trying to run any unittest with 'ENGINE': 'django_mongokit.mongodb' on Django 1.5 returns error.

Traceback: Testing started at 11:44 AM ... Creating test database for alias 'default'... Destroying test database for alias 'default'... Destroying test database 'mongodb'...

Process finished with exit code 1

Error Traceback (most recent call last): File "/home/zam/Envs/ebmesse/local/lib/python2.7/site-packages/django/test/testcases.py", line 259, in call self._pre_setup() File "/home/zam/Envs/ebmesse/local/lib/python2.7/site-packages/django/test/testcases.py", line 479, in _pre_setup self._fixture_setup() File "/home/zam/Envs/ebmesse/local/lib/python2.7/site-packages/django/test/testcases.py", line 829, in _fixture_setup if not connections_support_transactions(): File "/home/zam/Envs/ebmesse/local/lib/python2.7/site-packages/django/test/testcases.py", line 816, in connections_support_transactions for conn in connections.all()) File "/home/zam/Envs/ebmesse/local/lib/python2.7/site-packages/django/test/testcases.py", line 816, in for conn in connections.all()) File "/home/zam/Envs/ebmesse/local/lib/python2.7/site-packages/django/utils/functional.py", line 43, in get res = instance.dict[self.func.name] = self.func(instance) File "/home/zam/Envs/ebmesse/local/lib/python2.7/site-packages/django/db/backends/init.py", line 455, in supports_transactions self.connection.leave_transaction_management() File "/home/zam/Envs/ebmesse/local/lib/python2.7/site-packages/pymongo/database.py", line 797, in call self.name, self.connection.class.name)) TypeError: 'Database' object is not callable. If you meant to call the 'leave_transaction_management' method on a 'ConnectionWrapper' object it is failing because no such method exists.

peterbe commented 11 years ago

The tests seem to fail because of a temporary misfortune of a poor test.

Your code looks great! Can you squash all bugs into 1 with a nice commit message and push it back into this pull request and then I'll merge it.

nickzam commented 11 years ago

Hope this will work

peterbe commented 11 years ago

Rebased and landed on master https://github.com/peterbe/django-mongokit/commit/5004722f6220d77704124f18f4b950e22c4ade28

andrexus commented 11 years ago

Could you update pypy version with this bugfix included?

peterbe commented 11 years ago

0.2.6 done https://pypi.python.org/pypi/django-mongokit