Bullet-proof some static media operations in the unit tests.

Review Request #11918 — Created Jan. 10, 2022 and submitted — Latest diff uploaded

Information

Djblets
release-2.x

Reviewers

We had a couple of areas where we made some bad assumptions about static
media. These were specific to unit tests.

First, tests/settings.py build absolute paths relative to the current
working directory, assuming that directory would be tests. This won't
be a safe assumption when using pytest. Instead, we now build a path
relative to the tests/settings.py file.

We also had a test that deleted and rebuild some static media
directories. It assumed all parent directories for the static media path
existed, but this wasn't safe either. We now use os.makedirs() to
construct all missing parents.

Unit tests pass with the old test runner and the new pytest one in
all supported versions of Python.

Commits

Files