The Web App Project

The mediawebapp project contains top-level configuration and URL routes for the entire web application.

Settings

The mediawebapp project ships a number of settings files.

Generic settings

The default mediawebapp.settings module contains settings which are common to most deployment environments.

Test-suite specific settings

The mediawebapp.settings_testsuite module contains settings which are specific to the test suite environment. The default tox test environment uses this settings module when running the test suite.

mediawebapp.settings.tox.JWPLATFORM_API_KEY = 'xxx-not-a-key-xxx'

When running the test suite, we do not call any external APIs but we do check that the JWPLATFORM_... settings must be set.

mediawebapp.settings.tox.JWPLATFORM_EMBED_PLAYER_KEY = 'someplayer'

Use a fake player key for embedding.

mediawebapp.settings.tox.JWP_SYNC_ITEMS = False

Do not synchronise items using the JWP API unless tests expect it

mediawebapp.settings.tox.LOGGING = None

Be less verbose in logging with tox

mediawebapp.settings.tox.STATIC_ROOT = '/tmp/workspace/build/static'

Static files are collected into a directory determined by the tox configuration. See the tox.ini file.

mediawebapp.settings.tox.TEST_RUNNER = 'mediawebapp.test.runner.BufferedDiscoverRunner'

The default test runner is changed to one which captures stdout and stderr when running tests.

Developer specific settings

Custom test suite runner

The test suite settings overrides the TEST_RUNNER setting to point to BufferedTextTestRunner. This runner captures output to stdout and stderr and only reports the output if a test fails. This helps make our tests a little less noisy.

class mediawebapp.test.runner.BufferedDiscoverRunner(pattern=None, top_level=None, verbosity=1, interactive=True, failfast=False, keepdb=False, reverse=False, debug_mode=False, debug_sql=False, parallel=0, tags=None, exclude_tags=None, **kwargs)

A sub-class of django.test.runner.DiscoverRunner which has exactly the same behaviour except that the test_runner attribute is set to BufferedTextTestRunner.

The upshot of this is that output to stdout and stderror is captured and only reported on test failure.

class mediawebapp.test.runner.BufferedTextTestRunner(stream=None, descriptions=True, verbosity=1, failfast=False, buffer=True, resultclass=None, warnings=None, *, tb_locals=False, **kwargs)

A sub-class of unittest.TextTestRunner with identical behaviour except that the buffer keyword argument to the constructor defaults to True.