Reputation: 2586
I have a pyramid application that I am testing using WebTest with the following code:
class FunctionalTests(unittest.TestCase):
def setUp(self):
from test_app import main
app = main({})
from webtest import TestApp
self.testapp = TestApp(app)
def test_not_found(self):
self.testapp.get("/not_found", status=404)
The view for not found is defined as follow:
@notfound_view_config(renderer="../templates/404.jinja2")
def notfound_view(request):
request.response.status = 404 # This is line 6
return {} # This is line 7
The coverage for the no found view is:
Name Stmts Miss Branch BrPart Cover Missing
test_app/views/notfound.py 4 2 0 0 50% 6-7
But there is no way that those line were skipped in the test so why coverage missed them?
This is my .coveragerc
[run]
branch = True
source = test_app
# omit = bad_file.py
[paths]
source =
test_app/
*/site-packages/
[report]
show_missing = True
I run the test with:
pytest --cov=formshare
Upvotes: 0
Views: 34