summaryrefslogtreecommitdiff
path: root/docs/narr/myproject
diff options
context:
space:
mode:
Diffstat (limited to 'docs/narr/myproject')
-rw-r--r--docs/narr/myproject/.coveragerc1
-rw-r--r--docs/narr/myproject/MANIFEST.in3
-rw-r--r--docs/narr/myproject/README.txt4
-rw-r--r--docs/narr/myproject/myproject/views/default.py2
-rw-r--r--docs/narr/myproject/myproject/views/notfound.py2
-rw-r--r--docs/narr/myproject/pytest.ini7
-rw-r--r--docs/narr/myproject/setup.py4
-rw-r--r--docs/narr/myproject/tests/__init__.py0
-rw-r--r--docs/narr/myproject/tests/test_it.py (renamed from docs/narr/myproject/myproject/tests.py)14
9 files changed, 26 insertions, 11 deletions
diff --git a/docs/narr/myproject/.coveragerc b/docs/narr/myproject/.coveragerc
index f0c31d6d7..5837f5504 100644
--- a/docs/narr/myproject/.coveragerc
+++ b/docs/narr/myproject/.coveragerc
@@ -1,3 +1,2 @@
[run]
source = myproject
-omit = myproject/test*
diff --git a/docs/narr/myproject/MANIFEST.in b/docs/narr/myproject/MANIFEST.in
index 1c24b8c0c..f516697f5 100644
--- a/docs/narr/myproject/MANIFEST.in
+++ b/docs/narr/myproject/MANIFEST.in
@@ -1,2 +1,5 @@
include *.txt *.ini *.cfg *.rst
recursive-include myproject *.ico *.png *.css *.gif *.jpg *.pt *.txt *.mak *.mako *.js *.html *.xml *.jinja2
+recursive-include tests *
+recursive-exclude * __pycache__
+recursive-exclude * *.py[co]
diff --git a/docs/narr/myproject/README.txt b/docs/narr/myproject/README.txt
index 2ffc0acba..6c5a0fee0 100644
--- a/docs/narr/myproject/README.txt
+++ b/docs/narr/myproject/README.txt
@@ -1,4 +1,4 @@
-MyProject
+myproject
=========
Getting Started
@@ -6,7 +6,7 @@ Getting Started
- Change directory into your newly created project.
- cd MyProject
+ cd myproject
- Create a Python virtual environment.
diff --git a/docs/narr/myproject/myproject/views/default.py b/docs/narr/myproject/myproject/views/default.py
index 8324cfe32..619ce1c0f 100644
--- a/docs/narr/myproject/myproject/views/default.py
+++ b/docs/narr/myproject/myproject/views/default.py
@@ -1,6 +1,6 @@
from pyramid.view import view_config
-@view_config(route_name='home', renderer='../templates/mytemplate.jinja2')
+@view_config(route_name='home', renderer='myproject:templates/mytemplate.jinja2')
def my_view(request):
return {'project': 'myproject'}
diff --git a/docs/narr/myproject/myproject/views/notfound.py b/docs/narr/myproject/myproject/views/notfound.py
index 69d6e2804..5abebb277 100644
--- a/docs/narr/myproject/myproject/views/notfound.py
+++ b/docs/narr/myproject/myproject/views/notfound.py
@@ -1,7 +1,7 @@
from pyramid.view import notfound_view_config
-@notfound_view_config(renderer='../templates/404.jinja2')
+@notfound_view_config(renderer='myproject:templates/404.jinja2')
def notfound_view(request):
request.response.status = 404
return {}
diff --git a/docs/narr/myproject/pytest.ini b/docs/narr/myproject/pytest.ini
index b1b5f4c38..5c8c59068 100644
--- a/docs/narr/myproject/pytest.ini
+++ b/docs/narr/myproject/pytest.ini
@@ -1,3 +1,6 @@
[pytest]
-testpaths = myproject
-python_files = *.py
+addopts = --strict
+
+testpaths =
+ myproject
+ tests
diff --git a/docs/narr/myproject/setup.py b/docs/narr/myproject/setup.py
index 1ee272270..e5872df29 100644
--- a/docs/narr/myproject/setup.py
+++ b/docs/narr/myproject/setup.py
@@ -25,7 +25,7 @@ tests_require = [
setup(
name='myproject',
version='0.0',
- description='MyProject',
+ description='myproject',
long_description=README + '\n\n' + CHANGES,
classifiers=[
'Programming Language :: Python',
@@ -37,7 +37,7 @@ setup(
author_email='',
url='',
keywords='web pyramid pylons',
- packages=find_packages(),
+ packages=find_packages(exclude=['tests']),
include_package_data=True,
zip_safe=False,
extras_require={
diff --git a/docs/narr/myproject/tests/__init__.py b/docs/narr/myproject/tests/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/docs/narr/myproject/tests/__init__.py
diff --git a/docs/narr/myproject/myproject/tests.py b/docs/narr/myproject/tests/test_it.py
index 05ccadcfb..b300da34d 100644
--- a/docs/narr/myproject/myproject/tests.py
+++ b/docs/narr/myproject/tests/test_it.py
@@ -11,10 +11,16 @@ class ViewTests(unittest.TestCase):
testing.tearDown()
def test_my_view(self):
- from .views.default import my_view
+ from myproject.views.default import my_view
request = testing.DummyRequest()
info = my_view(request)
- self.assertEqual(info['project'], 'MyProject')
+ self.assertEqual(info['project'], 'myproject')
+
+ def test_notfound_view(self):
+ from myproject.views.notfound import notfound_view
+ request = testing.DummyRequest()
+ info = notfound_view(request)
+ self.assertEqual(info, {})
class FunctionalTests(unittest.TestCase):
@@ -27,3 +33,7 @@ class FunctionalTests(unittest.TestCase):
def test_root(self):
res = self.testapp.get('/', status=200)
self.assertTrue(b'Pyramid' in res.body)
+
+ def test_notfound(self):
+ res = self.testapp.get('/badurl', status=404)
+ self.assertTrue(res.status_code == 404)