我正在尝试使用 pymongo 版本为 2.X 和 mongoengine 0.10.6 的 mongomock 运行测试用例
我试图将 pymongo 的版本从 2.6.3 更改为 2.9.5,将 mongoengine 从 0.10.6 更改为 0.17.0。我尝试过从 3.0.0 到 3.17.0 的 mongomock
@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
)
我希望测试用例能够通过我目前收到的消息
======================================================================
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)