diff --git a/docs/README.md b/docs/README.md index ce4038e74a..ac7f58030b 100644 --- a/docs/README.md +++ b/docs/README.md @@ -42,9 +42,11 @@ cd docs/ make html ``` -and then opening `file:///path/to/zulip/docs/_build/html/index.html` in -your browser (you can also use e.g. `firefox -docs/_build/html/index.html` from the root of your Zulip checkout). +and then opening `http://127.0.0.1:9991/docs/index.html` in your +browser. The raw files are available at +`file:///path/to/zulip/docs/_build/html/index.html` in your browser +(so you can also use e.g. `firefox docs/_build/html/index.html` from +the root of your Zulip checkout). If you are adding a new page to the table of contents, you will want to modify `docs/index.rst` and run `make clean` before `make html`, so diff --git a/docs/testing-with-django.md b/docs/testing-with-django.md index af3201d3da..08322b9a24 100644 --- a/docs/testing-with-django.md +++ b/docs/testing-with-django.md @@ -240,9 +240,13 @@ typically simulate their behavior using mocks. - **Coverage** We have 100% line coverage on several of our backend modules. You can use the `--coverage` option to generate coverage -reports, and new code should have 100% coverage, which generally requires -testing not only the "happy path" but also error handling code and -edge cases. Note that `test-backend --coverage` will assert that +reports, and new code should have 100% coverage, which generally +requires testing not only the "happy path" but also error handling +code and edge cases. It will generate a nice HTML report that you can +view right from your browser (the tool prints the URL where the report +is exposed in your development environment). + +Note that `test-backend --coverage` will assert that various specific files in the project have 100% test coverage and throw an error if their coverage has fallen. One of our project goals is to expand that checking to ever-larger parts of the codebase. diff --git a/tools/test-backend b/tools/test-backend index 9a588cfe1d..bc5fc3914f 100755 --- a/tools/test-backend +++ b/tools/test-backend @@ -292,7 +292,7 @@ if __name__ == "__main__": print("Printing coverage data") cov.report(show_missing=False) cov.html_report(directory='var/coverage') - print("HTML report saved to var/coverage") + print("HTML report saved; visit at http://127.0.0.1:9991/coverage/index.html") if full_suite and not failures and options.coverage: # Assert that various files have full coverage for path in enforce_fully_covered: diff --git a/zerver/lib/test_helpers.py b/zerver/lib/test_helpers.py index be8ffee789..d8f7ffb0fb 100644 --- a/zerver/lib/test_helpers.py +++ b/zerver/lib/test_helpers.py @@ -386,10 +386,15 @@ def write_instrumentation_reports(full_suite): assert len(pattern_cnt) > 100 untested_patterns = set([p for p in pattern_cnt if pattern_cnt[p] == 0]) - # We exempt some patterns that are called via Tornado. exempt_patterns = set([ + # We exempt some patterns that are called via Tornado. 'api/v1/events', 'api/v1/register', + # We also exempt some development environment debugging + # static content URLs, since the content they point to may + # or may not exist. + 'coverage/(?P.*)', + 'docs/(?P.*)', ]) untested_patterns -= exempt_patterns diff --git a/zproject/dev_urls.py b/zproject/dev_urls.py index f14b6d259d..3454111aed 100644 --- a/zproject/dev_urls.py +++ b/zproject/dev_urls.py @@ -11,10 +11,18 @@ use_prod_static = getattr(settings, 'PIPELINE_ENABLED', False) static_root = os.path.join(settings.DEPLOY_ROOT, 'prod-static/serve' if use_prod_static else 'static') urls = [ + url(r'^coverage/(?P.*)$', + serve, {'document_root': + os.path.join(settings.DEPLOY_ROOT, 'var/coverage'), + 'show_indexes': True}), + url(r'^docs/(?P.*)$', + serve, {'document_root': + os.path.join(settings.DEPLOY_ROOT, 'docs/_build/html')}), url(r'^static/(?P.*)$', serve, {'document_root': static_root}), url(r'^devlogin/$', zerver.views.auth.login_page, {'template_name': 'zerver/dev_login.html'}, name='zerver.views.auth.login_page'), ] + i18n_urls = [ url(r'^confirmation_key/$', zerver.views.registration.confirmation_key), ]