Skip to content

Commit

Permalink
Minor improvements and fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoddemus committed Jan 28, 2020
1 parent 6dcbf84 commit 4de0aa6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/_pytest/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,7 @@ def execute(self, request):
if cached_result is not None:
result, cache_key, err = cached_result
# note: comparison with `==` can fail (or be expensive) for e.g.
# numpy arrays
# numpy arrays (#6497)
if my_cache_key is cache_key:
if err is not None:
_, val, tb = err
Expand Down
9 changes: 5 additions & 4 deletions testing/python/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -1109,15 +1109,14 @@ def test_parameters_without_eq_semantics(self, scope, testdir):
class NoEq1: # fails on `a == b` statement
def __eq__(self, _):
raise RuntimeError
class NoEq2: # fails on `if a == b:` statement
def __eq__(self, _):
class NoBool:
def __bool__(self):
raise RuntimeError
__nonzero__ = __bool__ # for Py2
return NoBool()
import pytest
@pytest.fixture(params=[NoEq1(), NoEq2()], scope={scope!r})
def no_eq(request):
Expand All @@ -1128,7 +1127,9 @@ def test1(no_eq):
def test2(no_eq):
pass
""".format(scope=scope)
""".format(
scope=scope
)
)
result = testdir.runpytest()
result.stdout.fnmatch_lines(["*4 passed*"])
Expand Down

0 comments on commit 4de0aa6

Please sign in to comment.