[Pytest-commit] commit/pytest: witsch: allow test items to not be associated with a test function

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Wed Oct 2 16:09:42 CEST 2013


1 new commit in pytest:

https://bitbucket.org/hpk42/pytest/commits/ac9232a10ef4/
Changeset:   ac9232a10ef4
User:        witsch
Date:        2013-10-02 15:55:28
Summary:     allow test items to not be associated with a test function

this is needed for plugins like `pytest-pep8` or `pytest-flakes`
Affected #:  1 file

diff -r 10b3d5df19ab31daca4bca40ef848049d7f6298b -r ac9232a10ef45dc510f1b33102b1b8ac501429c8 _pytest/mark.py
--- a/_pytest/mark.py
+++ b/_pytest/mark.py
@@ -139,8 +139,9 @@
         mapped_names.add(name)
 
     # Add the names attached to the current function through direct assignment
-    for name in colitem.function.__dict__:
-        mapped_names.add(name)
+    if hasattr(colitem, 'function'):
+        for name in colitem.function.__dict__:
+            mapped_names.add(name)
 
     return eval(keywordexpr, {}, KeywordMapping(mapped_names))

Repository URL: https://bitbucket.org/hpk42/pytest/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.


More information about the pytest-commit mailing list