[py-dev] [hpk42/pytest] pytest blows up when collecting modules with uninspectable objects (issue #214)

Thomas Waldmann issues-reply at bitbucket.org
Wed Oct 31 02:59:21 CET 2012


--- you can reply above this line ---

New issue 214: pytest blows up when collecting modules with uninspectable objects
https://bitbucket.org/hpk42/pytest/issue/214/pytest-blows-up-when-collecting-modules

Thomas Waldmann:

werkzeug/flask offers some threadlocals to comfortable access stuff like (http) request, session, (wsgi) app, etc. - those objects are special and only valid when a request is running or an app was created.

if you access them before / after they are valid, it'll raise a RuntimeError.

while collecting tests, pytest (since 2.3) accesses all module-level objects and tries to inspect them for a specific attribute, causing a RuntimeError exception when it does that on such special objects.

thus, the usual code used in about every flask app makes pytest unusable:

from flask import request, session  # <- threadlocals

a simple patch that solves the issue is attached.


--

This is an issue notification from bitbucket.org. You are receiving
this either because you are the owner of the issue, or you are
following the issue.



More information about the Pytest-dev mailing list