coralnet icon indicating copy to clipboard operation
coralnet copied to clipboard

Consider overriding SITE_DIR setting for unit tests

Open StephenChan opened this issue 4 years ago • 2 comments

The biggest reason is that log files are currently shared between the actual server and unit tests. We typically only run unit tests in dev environments (and maybe staging), but it'd still be nice to not clog up the log files with unit-test output. If unit tests use a separate SITE_DIR, then that directory could be cleaned up after testing.

Other files located based on SITE_DIR include tmp files, and the maintenance-status file (from issue #155). We might also be able to simplify the CACHES setting override, which looks like this right now:

test_settings['CACHES'] = {
    'default': {
        'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
        'LOCATION': 'test',
    }
}

StephenChan avatar Apr 05 '20 08:04 StephenChan

In PR #324, we had to mute the logger during testing, perhaps because of how spacer uses the logging module. So if we still want the logger activated during unit tests (for example, to test the log output itself), then that is something that needs resolving.

StephenChan avatar Jun 18 '20 20:06 StephenChan