summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2016-12-26 15:27:39 -0500
committerJason R. Coombs <jaraco@jaraco.com>2016-12-26 15:27:39 -0500
commit843956dc3772be074950662b118c76cfead1f4a5 (patch)
tree5c35fd40f170d7d4e043329cb70d148f05567768 /tests
parent6da8b85776bd784b825e8dc82ca0f3fbecad9173 (diff)
downloadcherrypy-git-843956dc3772be074950662b118c76cfead1f4a5.tar.gz
Add test capturing failed expectation. Ref #1538.
Diffstat (limited to 'tests')
-rw-r--r--tests/dist-check.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/dist-check.py b/tests/dist-check.py
new file mode 100644
index 00000000..53eb570b
--- /dev/null
+++ b/tests/dist-check.py
@@ -0,0 +1,35 @@
+import os
+import sys
+
+import pytest
+
+
+@pytest.fixture(params=[
+ 'scaffold/static/made_with_cherrypy_small.png',
+ 'tutorial/tutorial.conf',
+ 'tutorial/custom_error.html',
+])
+def data_file_path(request):
+ return request.param
+
+
+@pytest.fixture(autouse=True, scope="session")
+def remove_sys_path_0():
+ "pytest adds cwd to sys.path[0]"
+ print("removing", sys.path[0])
+ del sys.path[0]
+ assert 'cherrypy' not in sys.modules
+
+
+def test_data_files_installed(data_file_path):
+ import cherrypy
+ root = os.path.dirname(cherrypy.__file__)
+ fn = os.path.join(root, data_file_path)
+ assert os.path.exists(fn), fn
+ # make sure the file isn't in the local checkout
+ assert not os.path.samefile(fn, os.path.join('cherrypy', data_file_path))
+
+
+def test_sanity():
+ with pytest.raises(Exception):
+ test_data_files_installed('does not exist')