From 60a53c75a6b3efcb0d6f68395f8da03a03060448 Mon Sep 17 00:00:00 2001 From: holger krekel Date: Tue, 16 Jul 2013 15:43:20 +0200 Subject: [PATCH] some python2.5/3.3 fixes of Brianna's parametrize improvements --- _pytest/__init__.py | 2 +- _pytest/python.py | 3 ++- setup.py | 2 +- testing/python/metafunc.py | 10 +++++----- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/_pytest/__init__.py b/_pytest/__init__.py index 0fcc78673..b9dd21817 100644 --- a/_pytest/__init__.py +++ b/_pytest/__init__.py @@ -1,2 +1,2 @@ # -__version__ = '2.4.0.dev5' +__version__ = '2.4.0.dev6' diff --git a/_pytest/python.py b/_pytest/python.py index 81b8e1485..6eda8b7d3 100644 --- a/_pytest/python.py +++ b/_pytest/python.py @@ -2,7 +2,6 @@ import py import inspect import sys -from types import NoneType import pytest from _pytest.main import getfslineno from _pytest.mark import MarkDecorator, MarkInfo @@ -12,6 +11,8 @@ from py._code.code import TerminalRepr import _pytest cutdir = py.path.local(_pytest.__file__).dirpath() +NoneType = type(None) + callable = py.builtin.callable def getimfunc(func): diff --git a/setup.py b/setup.py index c5e7890f7..f99a8f256 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ def main(): name='pytest', description='py.test: simple powerful testing with Python', long_description = long_description, - version='2.4.0.dev5', + version='2.4.0.dev6', url='http://pytest.org', license='MIT license', platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'], diff --git a/testing/python/metafunc.py b/testing/python/metafunc.py index 6928f27d7..16182b779 100644 --- a/testing/python/metafunc.py +++ b/testing/python/metafunc.py @@ -99,12 +99,12 @@ class TestMetafunc: def func(x, y): pass metafunc = self.Metafunc(func) - with pytest.raises(ValueError): - metafunc.parametrize("x", [1,2], ids=['basic']) + pytest.raises(ValueError, lambda: + metafunc.parametrize("x", [1,2], ids=['basic'])) - with pytest.raises(ValueError): + pytest.raises(ValueError, lambda: metafunc.parametrize(("x","y"), [("abc", "def"), - ("ghi", "jkl")], ids=["one"]) + ("ghi", "jkl")], ids=["one"])) def test_parametrize_with_userobjects(self): def func(x, y): pass @@ -140,7 +140,7 @@ class TestMetafunc: (True, False), (None, None), (list("six"), [66, 66]), - ({7}, set("seven")), + (set([7]), set("seven")), (tuple("eight"), (8, -8, 8)) ]) assert result == ["1.0--1.1",