TurboGears / tg2

Python web framework with full-stack layer implemented on top of a microframework core with support for SQL DBMS, MongoDB and Pluggable Applications
http://www.turbogears.org/
Other
806 stars 78 forks source link

Tests fail with Python 2.7.13 #88

Closed olivierlemasle closed 7 years ago

olivierlemasle commented 7 years ago

Tests fail on branch development with Python 2.7.13.

I've used the exact same command as Travis CI. The build may be broken by an updated dependency...

======================================================================
ERROR: test_smart_auth_json (tests.test_stack.test_authz.TestRequire)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/vagrant/tg2/tests/test_stack/test_authz.py", line 377, in test_smart_auth_json
    assert 'The current user must be "developer"' in resp.json['detail']
  File "/home/vagrant/env/lib/python2.7/site-packages/webtest/app.py", line 595, in json
    % self.content_type)
AttributeError: Not a JSON response body (content-type: text/plain)
-------------------- >> begin captured logging << --------------------
tg.appwrappers.i18n: DEBUG: i18n enabled: False -> {'no_session_touch': False, 'lang_session_key': 'tg_lang', 'enabled': False, 'lang': None}
tg.appwrappers.identity: DEBUG: Identity enabled: True -> {'allow_missing_user': True, 'enabled': True, 'authmetadata': <tests.test_stack.test_authz.TestAuthMetadata object at 0x7fe555cf1050>}
tg.appwrappers.caching: DEBUG: Caching enabled: True -> {'data_dir': None, 'cache_dir': '/home/vagrant/tg2/tests/cache', 'expire': None, 'log_file': None, 'type': 'memory'}
tg.appwrappers.session: DEBUG: Sessions enabled: True -> {'secret': None, 'invalidate_corrupt': True, 'data_dir': '/home/vagrant/tg2/tests/session', 'key': 'beaker.session.id', 'timeout': None, 'log_file': None, 'type': None}
--------------------- >> end captured logging << ---------------------

======================================================================
ERROR: test_smart_auth_json_allow_only (tests.test_stack.test_authz.TestRequire)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/vagrant/tg2/tests/test_stack/test_authz.py", line 396, in test_smart_auth_json_allow_only
    assert 'The current user must be "developer"' in resp.json['detail']
  File "/home/vagrant/env/lib/python2.7/site-packages/webtest/app.py", line 595, in json
    % self.content_type)
AttributeError: Not a JSON response body (content-type: text/plain)
-------------------- >> begin captured logging << --------------------
tg.appwrappers.i18n: DEBUG: i18n enabled: False -> {'no_session_touch': False, 'lang_session_key': 'tg_lang', 'enabled': False, 'lang': None}
tg.appwrappers.identity: DEBUG: Identity enabled: True -> {'allow_missing_user': True, 'enabled': True, 'authmetadata': <tests.test_stack.test_authz.TestAuthMetadata object at 0x7fe555cf1950>}
tg.appwrappers.caching: DEBUG: Caching enabled: True -> {'data_dir': None, 'cache_dir': '/home/vagrant/tg2/tests/cache', 'expire': None, 'log_file': None, 'type': 'memory'}
tg.appwrappers.session: DEBUG: Sessions enabled: True -> {'secret': None, 'invalidate_corrupt': True, 'data_dir': '/home/vagrant/tg2/tests/session', 'key': 'beaker.session.id', 'timeout': None, 'log_file': None, 'type': None}
--------------------- >> end captured logging << ---------------------

======================================================================
FAIL: test_response_type_json (tests.test_tg_controller_dispatch.TestTGController)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/vagrant/tg2/tests/test_tg_controller_dispatch.py", line 887, in test_response_type_json
    assert 'json' in resp
AssertionError: 
    resp = self.app.get('/get_response_type.json')
>>  assert 'json' in resp

-------------------- >> begin captured logging << --------------------
tg.configuration.milestones: DEBUG: config_ready milestone reached
tg.configuration.milestones: DEBUG: renderers_ready milestone reached
tg.configuration.milestones: DEBUG: environment_loaded milestone reached
tg.appwrappers.i18n: DEBUG: i18n enabled: False -> {'no_session_touch': False, 'lang_session_key': 'tg_lang', 'enabled': False, 'lang': None}
tg.appwrappers.identity: DEBUG: Identity enabled: False -> {'allow_missing_user': True, 'enabled': True, 'authmetadata': None}
tg.appwrappers.caching: DEBUG: Caching enabled: True -> {'data_dir': None, 'cache_dir': '/home/vagrant/tg2/tests/cache', 'expire': None, 'log_file': None, 'type': 'memory'}
tg.appwrappers.session: DEBUG: Sessions enabled: True -> {'secret': None, 'invalidate_corrupt': True, 'data_dir': '/home/vagrant/tg2/tests/session', 'key': 'beaker.session.id', 'timeout': None, 'log_file': None, 'type': None}
--------------------- >> end captured logging << ---------------------

I've attached full output (commands passed to install dependency and test output) here: https://gist.github.com/olivierlemasle/a3c9714597263f9893ead7e6751e1769

amol- commented 7 years ago

I did run the test suite locally and all tests pass (I replicated your exact commands to avoid unintended differences).

My Python version is 2.7.10 btw, I'll try to install 2.7.13 to double check.

olivierlemasle commented 7 years ago

Thanks; that's strange. I've reproduced the same errors multiple times (with Python 2.7.13, on a clean VM).

I'll check myself with Python 2.7.10.

olivierlemasle commented 7 years ago

I ran again the tests with Python 2.7.13 and I still have the same test failures.

However, with Python 2.7.10, I can't even download the dependencies, as I encounter an error with command pip install --no-use-wheel -e .[testing]

I created a fork of tg2 in order to re-run the Travis tests. And fetching dependencies fails with Python 2.6, 2.7 and Pypy:

https://travis-ci.org/olivierlemasle/tg2/builds/215015958

As you can see, this was a build of tg2 as of commit 8cdb785, i.e. exactly the same commit as the successful Travis build 5 days before: https://travis-ci.org/TurboGears/tg2/builds/201427842

You can request a new Travis run to reproduce the issue.

amol- commented 7 years ago

The travis failures are related to setuptools as it got decided that it was a good idea to have the package management framework depend on packages itself. Which I won't express my opinion about... Removing the --no-use-wheel option should fix it, probably upgrading pip too to ensure it's the last version is a good idea.