• 
      

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

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

    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.

    Summary ID
    Bullet-proof some static media operations in the unit tests.
    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.
    f8cc581dad7118c0c3ea3f182a6bf8efca97d964
    david
    1. Ship It!
    2. 
        
    chipx86
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to release-2.x (df38c34)