PBR

Somehow PBR breaks other packages when installed by "setup.py test"

Bug #1533828 reported by Alessandro Molina
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
PBR
Incomplete
Undecided
Unassigned

Bug Description

It's not clear to me why but PBR seems to cause an odd side effect when it's installed during "python setup.py test".

I have a package that has tests_require=['WebTest >= 1.2.3', 'nose', 'coverage', 'gearbox', 'mock'] when I run the test suite through "python setup.py test" I get the following error:

File "/home/buildbot/slave/proj/build/testenv/lib/python2.7/site-packages/markupsafe/__init__.py", line 74, in __new__
    return text_type.__new__(cls, base)
TypeError: object.__new__(Markup) is not safe, use unicode.__new__()

Which is caused by markupsafe._compat.text_type being None which is theoretically impossible as it can only be unicode or str by https://github.com/mitsuhiko/markupsafe/blob/master/markupsafe/_compat.py

This seems to be caused by PBR, because if I already have pbr installed everything works as expected:

$ python setup.py test 2>&1 | grep test_forced_login -A1
proj.tests.functional.test_authentication.TestAuthentication.test_forced_login
Anonymous users are forced to login ... ok

but when I remove pbr and force setup.py to install it before running the testsuite, the error appears:

$ rm -r .eggs/pbr-1.8.1-py2.7.egg
$ python setup.py test
...
proj.tests.functional.test_authentication.TestAuthentication.test_forced_login
Anonymous users are forced to login ... ERROR
...
backlash: DEBUG: Traceback (most recent call last):
  File "/home/buildbot/slave/proj/build/scloby/scloby/templates/master.html", line 44, in <Expression '?'>
    <py:with vars="flash=tg.flash_obj.render('flash', use_js=False)">
  File "/home/buildbot/slave/proj/build/testenv/lib/python2.7/site-packages/tg/flash.py", line 134, in render
    return self._render_static_version(container_id)
  File "/home/buildbot/slave/proj/build/testenv/lib/python2.7/site-packages/tg/flash.py", line 140, in _render_static_version
    payload['message'] = escape(payload.get('message',''))
  File "/home/buildbot/slave/proj/build/testenv/lib/python2.7/site-packages/markupsafe/__init__.py", line 74, in __new__
    return text_type.__new__(cls, base)
TypeError: object.__new__(Markup) is not safe, use unicode.__new__()

So far it's totally unclear to me how markupsafe._compat.text_type can end up being None only when pbr is installed during tests setup, but that seems to be the reason

Revision history for this message
Alessandro Molina (alessandro-molina) wrote :

Seems also to be related to setuptools 19.2 as dowgrading setuptools to 19.1 also solves the issue

Revision history for this message
Alessandro Molina (alessandro-molina) wrote :

Happens again on new release of PBR and using setuptools 19.1 doesn't fix this anymore.

I had to add PBR to install dependencies even though it's only a test dependency (as it's required by mock)

Revision history for this message
Ben Nemec (bnemec) wrote :

We are a number of releases past 1.8.1 now, and I believe there have been some setuptools-related fixes since then. Can you confirm whether this still occurs in the current version of pbr? Thanks.

Changed in pbr:
status: New → Incomplete
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.