Update the test matrix to reflect what's supported in 2019 (#2066)
Previously, we were running the test suite for several combinations of MongoDB, Python, and PyMongo: - PyPy, MongoDB v2.6, PyMongo v3.x (which really means v3.6.1 at the moment) - Python v2.7, MongoDB v2.6, PyMongo v3.x - Python v3.5, MongoDB v2.6, PyMongo v3.x - Python v3.6, MongoDB v2.6, PyMongo v3.x - Python v2.7, MongoDB v3.0, PyMongo v3.5.0 - Python v3.6, MongoDB v3.0, PyMongo v3.5.0 - Python v3.5, MongoDB v3.2, PyMongo v3.x - Python v3.6, MongoDB v3.2, PyMongo v3.x - Python v3.6, MongoDB v3.4, PyMongo v3.x - Python v3.6, MongoDB v3.6, PyMongo v3.x There were a couple issues with this setup: 1. MongoDB v2.6 – v3.2 have reached their End of Life already (v2.6 almost 3 years ago!). See the "MongoDB Server" section on https://www.mongodb.com/support-policy. 2. We were only testing two recent-ish PyMongo versions (v3.5.0 & v3.6.1). We were not testing the oldest actively supported MongoDB/PyMongo/Python setup. This PR updates the test matrix so that these problems are solved. For the sake of simplicity, it does not yet attempt to cover MongoDB v4.0: - PyPy, MongoDB v3.4, PyMongo v3.x (aka v3.6.1 at the moment) - Python v2.7, MongoDB v3.4, PyMongo v3.x - Python v3.5, MongoDB v3.4, PyMongo v3.x - Python v3.6, MongoDB v3.4, PyMongo v3.x - Python v2.7, MongoDB v3.4, PyMongo v3.4 - Python v3.6, MongoDB v3.6, PyMongo v3.x
This commit is contained in:
		| @@ -117,10 +117,22 @@ def _get_connection_settings( | ||||
|                     ReadPreference.PRIMARY, | ||||
|                     ReadPreference.PRIMARY_PREFERRED, | ||||
|                     ReadPreference.SECONDARY, | ||||
|                     ReadPreference.SECONDARY_PREFERRED) | ||||
|                 read_pf_mode = uri_options['readpreference'].lower() | ||||
|                     ReadPreference.SECONDARY_PREFERRED, | ||||
|                 ) | ||||
|  | ||||
|                 # Starting with PyMongo v3.5, the "readpreference" option is | ||||
|                 # returned as a string (e.g. "secondaryPreferred") and not an | ||||
|                 # int (e.g. 3). | ||||
|                 # TODO simplify the code below once we drop support for | ||||
|                 # PyMongo v3.4. | ||||
|                 read_pf_mode = uri_options['readpreference'] | ||||
|                 if isinstance(read_pf_mode, six.string_types): | ||||
|                     read_pf_mode = read_pf_mode.lower() | ||||
|                 for preference in read_preferences: | ||||
|                     if preference.name.lower() == read_pf_mode: | ||||
|                     if ( | ||||
|                         preference.name.lower() == read_pf_mode or | ||||
|                         preference.mode == read_pf_mode | ||||
|                     ): | ||||
|                         conn_settings['read_preference'] = preference | ||||
|                         break | ||||
|         else: | ||||
|   | ||||
| @@ -7,10 +7,6 @@ from mongoengine.connection import get_connection | ||||
| # Constant that can be used to compare the version retrieved with | ||||
| # get_mongodb_version() | ||||
| MONGODB_36 = (3, 6) | ||||
| MONGODB_34 = (3, 4) | ||||
| MONGODB_32 = (3, 2) | ||||
| MONGODB_3 = (3, 0) | ||||
| MONGODB_26 = (2, 6) | ||||
|  | ||||
|  | ||||
| def get_mongodb_version(): | ||||
|   | ||||
		Reference in New Issue
	
	Block a user