Permalink
Browse files

Add docstrings for clarity and to address pre-commit checks. Exclude …

…dist-check from pre-commit name check.
  • Loading branch information...
1 parent 63f5e94 commit 9f8efb28f903f3abe4764c485356c83e41adfa66 @jaraco jaraco committed Dec 27, 2016
Showing with 24 additions and 0 deletions.
  1. +1 −0 .pre-commit-config.yaml
  2. +23 −0 tests/dist-check.py
@@ -11,6 +11,7 @@
include: cherrypy/test/
args:
- '--django'
+ exclude: tests/dist-check.py
- id: debug-statements
- id: check-added-large-files
- id: check-ast
View
@@ -1,3 +1,17 @@
+"""
+Integration test to check the integrity of the
+distribution.
+
+This file is explicitly not named 'test_' to avoid
+being collected by pytest, but must instead be
+invoked explicitly (i.e. pytest tests/dist-check.py).
+
+This test cannot be invoked as part of the normal
+test suite nor can it be included in the normal test
+suite because it must import cherrypy late (after
+removing sys.path[0]).
+"""
+
import os
import sys
@@ -11,6 +25,7 @@
'tutorial/custom_error.html',
])
def data_file_path(request):
+ "generates data file paths expected to be found in the package"
return request.param
@@ -23,6 +38,10 @@ def remove_sys_path_0():
def test_data_files_installed(data_file_path):
+ """
+ Ensure that data file paths are available in the
+ installed package as expected.
+ """
import cherrypy
root = os.path.dirname(cherrypy.__file__)
fn = os.path.join(root, data_file_path)
@@ -32,5 +51,9 @@ def test_data_files_installed(data_file_path):
def test_sanity():
+ """
+ Test the test to show that it does fail when a file
+ is missing.
+ """
with pytest.raises(Exception):
test_data_files_installed('does not exist')

0 comments on commit 9f8efb2

Please sign in to comment.