add MongoTestRunner and modify MongoTestCase #538

wants to merge 1 commit into


None yet
3 participants

I've added a MongoTestRunner that supports both Mongo and RDBMS backends. I've tested the new runner in the following contexts:

  • without an RDBMS configured in
  • using sqlite as RDBMS backend
  • using postgres as RDBMS

All tests were conducted with Django 1.4

The commit also adds a Testing section to the MongoEngine Django docs. I'm happy to modify the code or docs as you see fit. Let me know. Thanks!

Serdar Tumgoren

Serdar Tumgoren add MongoTestRunner and modify MongoTestCase
MongoTestRunner now supports both Mongo and RDBMS backends.
Also added Testing section to Django docs.

rozza commented Aug 1, 2012

Seems some overlap with MongoEngine/mongoengine#51 - any thoughts on either approach?

Hi Ross,
The TestSuiteRunner and TestCase in Pull Request 51 only support a stand-alone Mongo environment.

In other words, they will not allow you to run both Django ORM-backed tests and Mongo tests using the standard python test syntax.

I started out with such an approach, but because it's so common to have mixed RDBMS + Mongo environments, I decided to build a Test Suite Runner that handles all combinations (RDBMS-only, RDBMS+Mongo, Mongo-only).

Would it make sense to have two Test Runners and associated Test Cases? If so, lig and I could rename our Runner and TestCase classes to better reflect their purposes. For instance, MongoStandaloneTestSuiteRunner and MongoDjangoTestSuiteRunner (I'll admit, those are probably a bit verbose). Thoughts?

lig commented Aug 10, 2012

This does not work completely if there is no DATABASES section in the settings at all.

lig commented Aug 10, 2012

@zstumgoren please look at my django-testing-utils branch. I've added hybrid classes to let the developer to choose at his own to use or not to use settings.DATABASES and RDBMS at all.

Personally I think that it is enough for all Django/Mongoengine setups.

I haven't tested your solution, but it looks like it covers all scenarios. Nicely done. I'm fine using that solution if Ross signs off on it.

zstumgoren closed this Jan 14, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment