Example of test failure output with pytest
Thomas De Schampheleire
patrickdepinguin at gmail.com
Thu May 14 14:44:11 EDT 2015
On Thu, May 14, 2015 at 8:35 AM, Thomas De Schampheleire
<patrickdepinguin at gmail.com> wrote:
> On May 14, 2015 12:39:15 AM CEST, Mads Kiilerich <mads at kiilerich.com> wrote:
>>Hi
>>
>>Some pytest feedback:
>>I'm sorry for being lazy and not approaching upstream, but it is so
>>appealing to talk directly to the friendly ambassadors ;-)
>>
>>One use case, with
>>https://bitbucket.org/conservancy/kallithea/commits/9b8ba0f1c87b4fe89481b2c2c8723f6636d147cd
>>
>>, I got (valid) test failures:
>>
>>
>>...
>>../kallithea-venv/lib/python2.7/site-packages/WebHelpers-1.3-py2.7.egg/webhelpers/pylonslib/flash.py:349:
>>
>>UnicodeEncodeError
>>----------------------------------------------------------------------------------------------
>>
>>Captured stdout call
>>-----------------------------------------------------------------------------------------------
>>7 literal(u'Created repository <a
>>href="/vcs_test_hg_new%C4%85%C4%99%C5%82">vcs_test_hg_new\u0105\u0119\u0142</a>')
>>__________________________________________________________________________
>>
>>TestHomeController.test_index_with_anonymous_access_disabled
>>___________________________________________________________________________
>>
>>self = <kallithea.tests.functional.test_home.TestHomeController
>>testMethod=test_index_with_anonymous_access_disabled>
>>
>> def test_index_with_anonymous_access_disabled(self):
>> with fixture.anon_access(False):
>> response = self.app.get(url(controller='home', action='index'),
>> > status=302)
>>
>>kallithea/tests/functional/test_home.py:42:
>>_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
>>
>>_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
>>
>>_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
>>build/bdist.linux-x86_64/egg/webob/request.py:1049: in get_response
>> ???
>>build/bdist.linux-x86_64/egg/webob/request.py:1022: in call_application
>> ???
>>../kallithea-venv/lib/python2.7/site-packages/WebTest-1.4.3-py2.7.egg/webtest/lint.py:179:
>>
>>in lint_app
>> iterator = application(environ, start_response_wrapper)
>>.eggs/Paste-2.0.1-py2.7.egg/paste/gzipper.py:31: in __call__
>> return self.application(environ, start_response)
>>.eggs/Paste-2.0.1-py2.7.egg/paste/cascade.py:130: in __call__
>> return self.apps[-1](environ, start_response)
>>.eggs/Paste-2.0.1-py2.7.egg/paste/registry.py:379: in __call__
>> app_iter = self.application(environ, start_response)
>>kallithea/lib/middleware/wrapper.py:43: in __call__
>> return self.application(environ, start_response)
>>kallithea/lib/base.py:277: in __call__
>> return self._handle_request(environ, start_response)
>>kallithea/lib/middleware/simplegit.py:68: in _handle_request
>> return self.application(environ, start_response)
>>kallithea/lib/base.py:277: in __call__
>> return self._handle_request(environ, start_response)
>>kallithea/lib/middleware/simplehg.py:73: in _handle_request
>> return self.application(environ, start_response)
>>../kallithea-venv/lib/python2.7/site-packages/Pylons-1.0-py2.7.egg/pylons/middleware.py:150:
>>
>>in __call__
>> self.app, environ, catch_exc_info=True)
>>../kallithea-venv/lib/python2.7/site-packages/Pylons-1.0-py2.7.egg/pylons/util.py:48:
>>
>>in call_wsgi_application
>> app_iter = application(environ, start_response)
>>../kallithea-venv/lib/python2.7/site-packages/WebError-0.10.3-py2.7.egg/weberror/errormiddleware.py:156:
>>
>>in __call__
>> return self.application(environ, start_response)
>>../kallithea-venv/lib/python2.7/site-packages/Beaker-1.6.4-py2.7.egg/beaker/middleware.py:155:
>>
>>in __call__
>> return self.wrap_app(environ, session_start_response)
>>../kallithea-venv/lib/python2.7/site-packages/Routes-1.13-py2.7.egg/routes/middleware.py:131:
>>
>>in __call__
>> response = self.app(environ, start_response)
>>../kallithea-venv/lib/python2.7/site-packages/Pylons-1.0-py2.7.egg/pylons/wsgiapp.py:107:
>>
>>in __call__
>> response = self.dispatch(controller, environ, start_response)
>>../kallithea-venv/lib/python2.7/site-packages/Pylons-1.0-py2.7.egg/pylons/wsgiapp.py:312:
>>
>>in dispatch
>> return controller(environ, start_response)
>>kallithea/lib/base.py:383: in __call__
>> return WSGIController.__call__(self, environ, start_response)
>>../kallithea-venv/lib/python2.7/site-packages/Pylons-1.0-py2.7.egg/pylons/controllers/core.py:211:
>>
>>in __call__
>> response = self._dispatch_call()
>>../kallithea-venv/lib/python2.7/site-packages/Pylons-1.0-py2.7.egg/pylons/controllers/core.py:162:
>>
>>in _dispatch_call
>> response = self._inspect_call(func)
>>../kallithea-venv/lib/python2.7/site-packages/Pylons-1.0-py2.7.egg/pylons/controllers/core.py:105:
>>
>>in _inspect_call
>> result = self._perform_call(func, args)
>>../kallithea-venv/lib/python2.7/site-packages/Pylons-1.0-py2.7.egg/pylons/controllers/core.py:57:
>>
>>in _perform_call
>> return func(**args)
>><string>:2: in index
>> ???
>>kallithea/lib/auth.py:785: in __wrapper
>> return redirect_to_login()
>>kallithea/lib/auth.py:726: in redirect_to_login
>> h.flash(h.literal(message), category='warning')
>>_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
>>
>>_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
>>
>>_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
>>
>>self = <kallithea.lib.helpers.Flash object at 0x7fe013463410>, message
>>=
>>literal(u'None'), category = 'warning', ignore_duplicate = False
>>
>> def __call__(self, message, category=None, ignore_duplicate=False):
>> """Add a message to the session.
>>
>> ``message`` is the message text.
>>
>> ``category`` is the message's category. If not specified,
>>the default
>> category will be used. Raise ``ValueError`` if the
>>category is not
>> in the list of allowed categories.
>>
>> If ``ignore_duplicate`` is true, don't add the message if
>>another
>> message with identical text has already been added. If the new
>> message has a different category than the original message,
>>change the
>> original message to the new category.
>>
>> """
>> print 7, repr(message)
>> > assert str(message) != 'None', message
>>E AssertionError: None
>>
>>../kallithea-venv/lib/python2.7/site-packages/WebHelpers-1.3-py2.7.egg/webhelpers/pylonslib/flash.py:349:
>>
>>AssertionError
>>----------------------------------------------------------------------------------------------
>>
>>Captured stdout call
>>-----------------------------------------------------------------------------------------------
>>7 literal(u'None')
>>_______________________________________________________________________
>>
>>TestHomeController.test_repo_summary_with_anonymous_access_disabled
>>_______________________________________________________________________
>>
>>self = <kallithea.tests.functional.test_home.TestHomeController
>>testMethod=test_repo_summary_with_anonymous_access_disabled>
>>
>> def test_repo_summary_with_anonymous_access_disabled(self):
>> with fixture.anon_access(False):
>> response = self.app.get(url(controller='summary',
>> action='index', repo_name=HG_REPO),
>> > status=302)
>>
>>kallithea/tests/functional/test_home.py:36:
>>_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
>>
>>_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
>>
>>_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
>>build/bdist.linux-x86_64/egg/webob/request.py:1049: in get_response
>> ???
>>build/bdist.linux-x86_64/egg/webob/request.py:1022: in call_application
>> ???
>>../kallithea-venv/lib/python2.7/site-packages/WebTest-1.4.3-py2.7.egg/webtest/lint.py:179:
>>
>>in lint_app
>> iterator = application(environ, start_response_wrapper)
>>.eggs/Paste-2.0.1-py2.7.egg/paste/gzipper.py:31: in __call__
>> return self.application(environ, start_response)
>>.eggs/Paste-2.0.1-py2.7.egg/paste/cascade.py:130: in __call__
>> return self.apps[-1](environ, start_response)
>>.eggs/Paste-2.0.1-py2.7.egg/paste/registry.py:379: in __call__
>> app_iter = self.application(environ, start_response)
>>kallithea/lib/middleware/wrapper.py:43: in __call__
>> return self.application(environ, start_response)
>>kallithea/lib/base.py:277: in __call__
>> return self._handle_request(environ, start_response)
>>kallithea/lib/middleware/simplegit.py:68: in _handle_request
>> return self.application(environ, start_response)
>>kallithea/lib/base.py:277: in __call__
>> return self._handle_request(environ, start_response)
>>kallithea/lib/middleware/simplehg.py:73: in _handle_request
>> return self.application(environ, start_response)
>>../kallithea-venv/lib/python2.7/site-packages/Pylons-1.0-py2.7.egg/pylons/middleware.py:150:
>>
>>in __call__
>> self.app, environ, catch_exc_info=True)
>>../kallithea-venv/lib/python2.7/site-packages/Pylons-1.0-py2.7.egg/pylons/util.py:48:
>>
>>in call_wsgi_application
>> app_iter = application(environ, start_response)
>>../kallithea-venv/lib/python2.7/site-packages/WebError-0.10.3-py2.7.egg/weberror/errormiddleware.py:156:
>>
>>in __call__
>> return self.application(environ, start_response)
>>../kallithea-venv/lib/python2.7/site-packages/Beaker-1.6.4-py2.7.egg/beaker/middleware.py:155:
>>
>>in __call__
>> return self.wrap_app(environ, session_start_response)
>>../kallithea-venv/lib/python2.7/site-packages/Routes-1.13-py2.7.egg/routes/middleware.py:131:
>>
>>in __call__
>> response = self.app(environ, start_response)
>>../kallithea-venv/lib/python2.7/site-packages/Pylons-1.0-py2.7.egg/pylons/wsgiapp.py:107:
>>
>>in __call__
>> response = self.dispatch(controller, environ, start_response)
>>../kallithea-venv/lib/python2.7/site-packages/Pylons-1.0-py2.7.egg/pylons/wsgiapp.py:312:
>>
>>in dispatch
>> return controller(environ, start_response)
>>kallithea/lib/base.py:383: in __call__
>> return WSGIController.__call__(self, environ, start_response)
>>../kallithea-venv/lib/python2.7/site-packages/Pylons-1.0-py2.7.egg/pylons/controllers/core.py:211:
>>
>>in __call__
>> response = self._dispatch_call()
>>../kallithea-venv/lib/python2.7/site-packages/Pylons-1.0-py2.7.egg/pylons/controllers/core.py:162:
>>
>>in _dispatch_call
>> response = self._inspect_call(func)
>>../kallithea-venv/lib/python2.7/site-packages/Pylons-1.0-py2.7.egg/pylons/controllers/core.py:105:
>>
>>in _inspect_call
>> result = self._perform_call(func, args)
>>../kallithea-venv/lib/python2.7/site-packages/Pylons-1.0-py2.7.egg/pylons/controllers/core.py:57:
>>
>>in _perform_call
>> return func(**args)
>><string>:2: in index
>> ???
>>kallithea/lib/auth.py:785: in __wrapper
>> return redirect_to_login()
>>kallithea/lib/auth.py:726: in redirect_to_login
>> h.flash(h.literal(message), category='warning')
>>_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
>>
>>_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
>>
>>_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
>>
>>self = <kallithea.lib.helpers.Flash object at 0x7fe013463410>, message
>>=
>>literal(u'None'), category = 'warning', ignore_duplicate = False
>>
>> def __call__(self, message, category=None, ignore_duplicate=False):
>> """Add a message to the session.
>>
>> ``message`` is the message text.
>>
>> ``category`` is the message's category. If not specified,
>>the default
>> category will be used. Raise ``ValueError`` if the
>>category is not
>> in the list of allowed categories.
>>
>> If ``ignore_duplicate`` is true, don't add the message if
>>another
>> message with identical text has already been added. If the new
>> message has a different category than the original message,
>>change the
>> original message to the new category.
>>
>> """
>> print 7, repr(message)
>> > assert str(message) != 'None', message
>>E AssertionError: None
>>
>>../kallithea-venv/lib/python2.7/site-packages/WebHelpers-1.3-py2.7.egg/webhelpers/pylonslib/flash.py:349:
>>
>>AssertionError
>>----------------------------------------------------------------------------------------------
>>
>>Captured stdout call
>>-----------------------------------------------------------------------------------------------
>>7 literal(u'None')
>>===============================================================================
>>
>>6 failed, 1588 passed, 2 skipped in 191.92 seconds
>>================================================================================
>>
>>
>
> In fact, given --tb=short, you shouldn't see all this output I think. There should be one line per failure describing it.
>
> This worked in my testing of these settings in setup.cfg.
>
I looked deeper into this, and the kallithea/tests/pytest.ini file
that was added recently does not turn out to be detected/used, since
setup.cfg in the root takes precedence.
Moving the pytest settings from kallithea/tests/pytest.ini file to
setup.cfg makes the output of failed tests as expected, for example:
('pytest -k test_str2bool' with deliberate failures):
kallithea/tests/other/test_libs.py .FFFFFFFFFFFFFFFFF
===========================================================================================
FAILURES ===========================================================================================
__________________________________________________________________________________
TestLibs.test_str2bool_0_t
__________________________________________________________________________________
kallithea/tests/parameterized.py:111: in parameterized_expand_helper_helper
return func(*(self + args))
kallithea/tests/other/test_libs.py:102: in test_str2bool
self.assertEqual(True, False)
E AssertionError: True != False
_________________________________________________________________________________
TestLibs.test_str2bool_10_T
__________________________________________________________________________________
kallithea/tests/parameterized.py:111: in parameterized_expand_helper_helper
return func(*(self + args))
kallithea/tests/other/test_libs.py:102: in test_str2bool
self.assertEqual(True, False)
E AssertionError: True != False
_______________________________________________________________________________
TestLibs.test_str2bool_11_False
________________________________________________________________________________
kallithea/tests/parameterized.py:111: in parameterized_expand_helper_helper
return func(*(self + args))
kallithea/tests/other/test_libs.py:102: in test_str2bool
self.assertEqual(True, False)
E AssertionError: True != False
_________________________________________________________________________________
TestLibs.test_str2bool_12_F
__________________________________________________________________________________
kallithea/tests/parameterized.py:111: in parameterized_expand_helper_helper
return func(*(self + args))
kallithea/tests/other/test_libs.py:102: in test_str2bool
self.assertEqual(True, False)
E AssertionError: True != False
_______________________________________________________________________________
TestLibs.test_str2bool_13_FALSE
________________________________________________________________________________
kallithea/tests/parameterized.py:111: in parameterized_expand_helper_helper
return func(*(self + args))
kallithea/tests/other/test_libs.py:102: in test_str2bool
self.assertEqual(True, False)
E AssertionError: True != False
_________________________________________________________________________________
TestLibs.test_str2bool_14_0
__________________________________________________________________________________
kallithea/tests/parameterized.py:111: in parameterized_expand_helper_helper
return func(*(self + args))
kallithea/tests/other/test_libs.py:102: in test_str2bool
self.assertEqual(True, False)
E AssertionError: True != False
_________________________________________________________________________________
TestLibs.test_str2bool_15_1
__________________________________________________________________________________
kallithea/tests/parameterized.py:111: in parameterized_expand_helper_helper
return func(*(self + args))
kallithea/tests/other/test_libs.py:102: in test_str2bool
self.assertEqual(True, False)
E AssertionError: True != False
__________________________________________________________________________________
TestLibs.test_str2bool_16_
__________________________________________________________________________________
kallithea/tests/parameterized.py:111: in parameterized_expand_helper_helper
return func(*(self + args))
kallithea/tests/other/test_libs.py:102: in test_str2bool
self.assertEqual(True, False)
E AssertionError: True != False
________________________________________________________________________________
TestLibs.test_str2bool_1_true
_________________________________________________________________________________
kallithea/tests/parameterized.py:111: in parameterized_expand_helper_helper
return func(*(self + args))
kallithea/tests/other/test_libs.py:102: in test_str2bool
self.assertEqual(True, False)
E AssertionError: True != False
__________________________________________________________________________________
TestLibs.test_str2bool_2_y
__________________________________________________________________________________
kallithea/tests/parameterized.py:111: in parameterized_expand_helper_helper
return func(*(self + args))
kallithea/tests/other/test_libs.py:102: in test_str2bool
self.assertEqual(True, False)
E AssertionError: True != False
_________________________________________________________________________________
TestLibs.test_str2bool_3_yes
_________________________________________________________________________________
kallithea/tests/parameterized.py:111: in parameterized_expand_helper_helper
return func(*(self + args))
kallithea/tests/other/test_libs.py:102: in test_str2bool
self.assertEqual(True, False)
E AssertionError: True != False
_________________________________________________________________________________
TestLibs.test_str2bool_4_on
__________________________________________________________________________________
kallithea/tests/parameterized.py:111: in parameterized_expand_helper_helper
return func(*(self + args))
kallithea/tests/other/test_libs.py:102: in test_str2bool
self.assertEqual(True, False)
E AssertionError: True != False
__________________________________________________________________________________
TestLibs.test_str2bool_5_1
__________________________________________________________________________________
kallithea/tests/parameterized.py:111: in parameterized_expand_helper_helper
return func(*(self + args))
kallithea/tests/other/test_libs.py:102: in test_str2bool
self.assertEqual(True, False)
E AssertionError: True != False
__________________________________________________________________________________
TestLibs.test_str2bool_6_Y
__________________________________________________________________________________
kallithea/tests/parameterized.py:111: in parameterized_expand_helper_helper
return func(*(self + args))
kallithea/tests/other/test_libs.py:102: in test_str2bool
self.assertEqual(True, False)
E AssertionError: True != False
_________________________________________________________________________________
TestLibs.test_str2bool_7_yeS
_________________________________________________________________________________
kallithea/tests/parameterized.py:111: in parameterized_expand_helper_helper
return func(*(self + args))
kallithea/tests/other/test_libs.py:102: in test_str2bool
self.assertEqual(True, False)
E AssertionError: True != False
__________________________________________________________________________________
TestLibs.test_str2bool_8_Y
__________________________________________________________________________________
kallithea/tests/parameterized.py:111: in parameterized_expand_helper_helper
return func(*(self + args))
kallithea/tests/other/test_libs.py:102: in test_str2bool
self.assertEqual(True, False)
E AssertionError: True != False
________________________________________________________________________________
TestLibs.test_str2bool_9_TRUE
_________________________________________________________________________________
kallithea/tests/parameterized.py:111: in parameterized_expand_helper_helper
return func(*(self + args))
kallithea/tests/other/test_libs.py:102: in test_str2bool
self.assertEqual(True, False)
E AssertionError: True != False
===================================================================================
short test summary info
====================================================================================
FAIL kallithea/tests/other/test_libs.py::TestLibs::test_str2bool_0_t
FAIL kallithea/tests/other/test_libs.py::TestLibs::test_str2bool_10_T
FAIL kallithea/tests/other/test_libs.py::TestLibs::test_str2bool_11_False
FAIL kallithea/tests/other/test_libs.py::TestLibs::test_str2bool_12_F
FAIL kallithea/tests/other/test_libs.py::TestLibs::test_str2bool_13_FALSE
FAIL kallithea/tests/other/test_libs.py::TestLibs::test_str2bool_14_0
FAIL kallithea/tests/other/test_libs.py::TestLibs::test_str2bool_15_1
FAIL kallithea/tests/other/test_libs.py::TestLibs::test_str2bool_16_
FAIL kallithea/tests/other/test_libs.py::TestLibs::test_str2bool_1_true
FAIL kallithea/tests/other/test_libs.py::TestLibs::test_str2bool_2_y
FAIL kallithea/tests/other/test_libs.py::TestLibs::test_str2bool_3_yes
FAIL kallithea/tests/other/test_libs.py::TestLibs::test_str2bool_4_on
FAIL kallithea/tests/other/test_libs.py::TestLibs::test_str2bool_5_1
FAIL kallithea/tests/other/test_libs.py::TestLibs::test_str2bool_6_Y
FAIL kallithea/tests/other/test_libs.py::TestLibs::test_str2bool_7_yeS
FAIL kallithea/tests/other/test_libs.py::TestLibs::test_str2bool_8_Y
FAIL kallithea/tests/other/test_libs.py::TestLibs::test_str2bool_9_TRUE
==========================================================================
1578 tests deselected by '-ktest_str2bool'
==========================================================================
====================================================================
17 failed, 1 passed, 1578 deselected in 43.79 seconds
=====================================================================
I'll send a patch to move these settings...
More information about the kallithea-general
mailing list