re-allow to parametrize with values that don't support __eq__ (closes issue213)
This commit is contained in:
parent
573599beb3
commit
fce13c3e46
|
@ -1,3 +1,9 @@
|
||||||
|
Changes between 2.3.2 and 2.3.3.dev
|
||||||
|
-----------------------------------
|
||||||
|
|
||||||
|
- fix issue213 - allow to parametrize with values like numpy arrays that
|
||||||
|
do not support an __eq__ operator
|
||||||
|
|
||||||
Changes between 2.3.1 and 2.3.2
|
Changes between 2.3.1 and 2.3.2
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
|
|
||||||
|
|
|
@ -598,7 +598,7 @@ class CallSpec2(object):
|
||||||
if valtype == "funcargs":
|
if valtype == "funcargs":
|
||||||
self.params[arg] = id
|
self.params[arg] = id
|
||||||
self._arg2scopenum[arg] = scopenum
|
self._arg2scopenum[arg] = scopenum
|
||||||
if val == _notexists:
|
if val is _notexists:
|
||||||
self._emptyparamspecified = True
|
self._emptyparamspecified = True
|
||||||
self._idlist.append(id)
|
self._idlist.append(id)
|
||||||
|
|
||||||
|
|
|
@ -313,6 +313,19 @@ class TestFunction:
|
||||||
reprec = testdir.inline_run()
|
reprec = testdir.inline_run()
|
||||||
reprec.assertoutcome(skipped=1)
|
reprec.assertoutcome(skipped=1)
|
||||||
|
|
||||||
|
def test_issue213_parametrize_value_no_equal(self, testdir):
|
||||||
|
testdir.makepyfile("""
|
||||||
|
import pytest
|
||||||
|
class A:
|
||||||
|
def __eq__(self, other):
|
||||||
|
raise ValueError("not possible")
|
||||||
|
@pytest.mark.parametrize('arg', [A()])
|
||||||
|
def test_function(arg):
|
||||||
|
assert arg.__class__.__name__ == "A"
|
||||||
|
""")
|
||||||
|
reprec = testdir.inline_run()
|
||||||
|
reprec.assertoutcome(passed=1)
|
||||||
|
|
||||||
def test_function_equality_with_callspec(self, testdir, tmpdir):
|
def test_function_equality_with_callspec(self, testdir, tmpdir):
|
||||||
items = testdir.getitems("""
|
items = testdir.getitems("""
|
||||||
import pytest
|
import pytest
|
||||||
|
|
Loading…
Reference in New Issue