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

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

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.

Summary ID
Fix a breakage during test discovery if mysqlclient is not installed.
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.
ee0f4d06a4c610819a7b51f3c53a5d4083126916
david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

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