Fix a breakage during test discovery if mysqlclient is not installed.

Review Request #10846 — Created Jan. 21, 2020 and submitted — Latest diff uploaded

Information

Djblets
release-1.0.x

Reviewers

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 an ImproperlyConfigured when
the mysqlclient dependency 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 ImproperlyConfigured is more correct, we're addressing
this by always allowing the module to import and to just inherit from
object if 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 mysqlclient installed.

Commits

Files