Test cases are failing using mongomock pymongo mongoengine

374 Views Asked by At

I am trying to run test cases with mongomock having pymongo version as 2.X and mongoengine 0.10.6

I have tried to change the version for pymongo to 2.9.5 from 2.6.3 and mongoengine from 0.10.6 to 0.17.0. I have tried with mongomock from 3.0.0 to 3.17.0

    @classmethod
    def setUpClass(cls):
        super(MongoTestCase, cls).setUpClass()
        cls.conn = mongoengine.connect(
            settings.MONGODB_NAME,
            host=settings.MONGODB_DATABASE_HOST,
            alias="default",
            is_mock=True
        )

I expect the test case to pass with message currently I am getting

======================================================================
ERROR: test_ibest_matches (packages.tests.test_utils.test_ibest_matches.TestIBestMatches)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/www/packages/tests/test_utils/test_ibest_matches.py", line 56, in test_ibest_matches
    **context))
  File "/www/packages/utils.py", line 228, in ibest_matches
    for vc in valid_contexts
  File "/www/packages/managers/base_package_manager.py", line 111, in best_matches
    for group, packages in groupby(pkgs, key=lambda k: k.group):
  File "/usr/lib/python2.7/site-packages/mongoengine/queryset/queryset.py", line 97, in _iter_results
    self._populate_cache()
  File "/usr/lib/python2.7/site-packages/mongoengine/queryset/queryset.py", line 116, in _populate_cache
    self._result_cache.append(self.next())
  File "/usr/lib/python2.7/site-packages/mongoengine/queryset/base.py", line 1407, in next
    raw_doc = self._cursor.next()
  File "/usr/lib/python2.7/site-packages/mongoengine/queryset/base.py", line 1482, in _cursor
    **self._cursor_args)
TypeError: find() got an unexpected keyword argument 'fields'

----------------------------------------------------------------------
Ran 44 tests in 3.273s

FAILED (errors=26)
0

There are 0 best solutions below