Fix a breakage during test discovery if mysqlclient is not installed.
Review Request #10846 — Created Jan. 21, 2020 and submitted — Latest diff uploaded
Djblets ships with a custom MySQL backend, which is designed to address
some limitations in older versions of Django. It inherits from the
Django MySQL backend, which will raise anImproperlyConfiguredwhen
themysqlclientdependency is missing. Unfortunately, since this is no
longer a development requirement for Djblets, it means we end up with
one general error (not tied to a test) during test discovery.While raising
ImproperlyConfiguredis more correct, we're addressing
this by always allowing the module to import and to just inherit from
objectif the parent class cannot be loaded. This fixes unit tests,
and if the dependency is missing in production, the backend will really
just flat-out break.
Unit tests pass with and without
mysqlclientinstalled.