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

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

chipx86
Djblets
release-1.0.x
djblets

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.

Summary
Fix a breakage during test discovery if mysqlclient is not installed.
david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-1.0.x (22e91db)
Loading...