Fix with get_defining_class on py33

This commit is contained in:
David Wolever
2013-05-19 17:23:38 -04:00
parent 8d49adfaa7
commit d2f1a98061
3 changed files with 4 additions and 4 deletions

View File

@@ -161,8 +161,8 @@ class parameterized(object):
if len(stack) <= 4:
return []
frame = stack[4]
code_context = frame[4][0].strip()
if not code_context.startswith("class "):
code_context = frame[4] and frame[4][0].strip()
if not (code_context and code_context.startswith("class ")):
return []
_, parents = code_context.split("(", 1)
parents, _ = parents.rsplit(")", 1)

View File

@@ -50,7 +50,7 @@ def test_warns_when_using_parameterized_with_TestCase():
try:
class TestTestCaseWarnsOnBadUseOfParameterized(TestCase):
@parameterized([42])
def test_should_throw_error(self, foo):
def test_in_subclass_of_TestCase(self, foo):
pass
except Exception as e:
assert_contains(str(e), "parameterized.expand")

View File

@@ -1,5 +1,5 @@
[tox]
envlist=py26,py27,py32
envlist=py26,py27,py32,py33
[testenv]
deps=nose==1.2.1