Skip to content
Prev Previous commit
Next Next commit
test the expected failure for pypy
  • Loading branch information
Joe Jevnik committed May 25, 2017
commit 4b251a062be28dfc8cdb2639285d37e50c9c6fb3
13 changes: 13 additions & 0 deletions tests/cloudpickle_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,19 @@ def g(n):
g2 = pickle_depickle(f2(2))
self.assertEqual(g2(5), 240)

@pytest.mark.skipif(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test actually should succeed on PyPy, no?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, this is a mistake

supports_recursive_closure,
reason="Recursive closures shouldn't raise an exception if supported"
)
@pytest.mark.xfail
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than a xfail, I'd like to see the specific exception tested for inside the test, so that we don't miss it failing for other reasons...

def test_recursive_closure_unsupported(self):
def f1():
def g():
return g
return g

pickle_depickle(f1())

def test_unhashable_closure(self):
def f():
s = set((1, 2)) # mutable set is unhashable
Expand Down