Add support for extension tests involving static media.

Review Request #10821 — Created Jan. 13, 2020 and submitted

Information

Djblets
release-2.0.x

Reviewers

We have unit tests that involve static media bundles, but they're not
really involving any actual files in those bundles, meaning that certain
logic never gets instrumented.

This change adds the settings and support needed to be able to involve
actual static files in tests. It does this by adding in several static
files (source and bundled, both raw and versioned), so that they can be
looked up through the static media system.

Since we're not using actual extensions backed by a Python package, we
needed to be able to fake results for static media lookups. Internally,
ExtensionManager used pkg_resources methods to perform lookups in
packages to get this information, and spying on those methods was one
possible way of doing this, but instead we're adding methods to
ExtensionInfo for performing these lookups. This abstracts much of the
actual package access away, and gives us a clearer target for spying
(and, down the road, we could make it possible to provide a subclass of
ExtensionInfo more specific for testing purposes).

Some tests had to change in order to test against versioned files.

Unit tests pass on all supported versions of Python.

Summary ID
Add support for extension tests involving static media.
We have unit tests that involve static media bundles, but they're not really involving any actual files in those bundles, meaning that certain logic never gets instrumented. This change adds the settings and support needed to be able to involve actual static files in tests. It does this by adding in several static files (source and bundled, both raw and versioned), so that they can be looked up through the static media system. Since we're not using actual extensions backed by a Python package, we needed to be able to fake results for static media lookups. Internally, `ExtensionManager` used `pkg_resources` methods to perform lookups in packages to get this information, and spying on those methods was one possible way of doing this, but instead we're adding methods to `ExtensionInfo` for performing these lookups. This abstracts much of the actual package access away, and gives us a clearer target for spying (and, down the road, we could make it possible to provide a subclass of `ExtensionInfo` more specific for testing purposes). Some tests had to change in order to test against versioned files.
cd086720647d519afae6bfcb682d6979927b8269
Description From Last Updated

F841 local variable 'fp' is assigned to but never used

reviewbotreviewbot
Checks run (1 failed, 1 succeeded)
flake8 failed.
JSHint passed.

flake8

chipx86
chipx86
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-2.0.x (50c31de)