Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with Django parallel test runner: hypothesis.errors.DeadlineExceeded is unpickleable #3426

Closed
ElectronicRU opened this issue Aug 1, 2022 · 1 comment · Fixed by #3427
Labels
interop how to play nicely with other packages

Comments

@ElectronicRU
Copy link

<snip>
  File "/usr/lib/python3.8/unittest/suite.py", line 122, in run
    test(result)
  File "/root/apps/netdb_demo/lib/python3.8/site-packages/hypothesis/extra/django/_impl.py", line 47, in __call__
    return unittest.TestCase.__call__(self, result)
  File "/usr/lib/python3.8/unittest/case.py", line 736, in __call__
    return self.run(*args, **kwds)
  File "/usr/lib/python3.8/unittest/case.py", line 684, in run
    self._feedErrorsToResult(result, outcome.errors)
  File "/usr/lib/python3.8/unittest/case.py", line 602, in _feedErrorsToResult
    result.addError(test, exc_info)
  File "/root/apps/netdb_demo/lib/python3.8/site-packages/django/test/runner.py", line 197, in addError
    self.check_picklable(test, err)
  File "/root/apps/netdb_demo/lib/python3.8/site-packages/django/test/runner.py", line 130, in check_picklable
    self._confirm_picklable(err)
  File "/root/apps/netdb_demo/lib/python3.8/site-packages/django/test/runner.py", line 104, in _confirm_picklable
    pickle.loads(pickle.dumps(obj))
  File "/root/apps/netdb_demo/lib/python3.8/site-packages/tblib/pickling_support.py", line 26, in unpickle_exception
    inst = func(*args)
TypeError: __init__() missing 1 required positional argument: 'deadline'

This happens because Exception by default reduces to arguments passed to its __init__, and DeadlineExceeded (and FailedHealthCheck, afaict) changes the signature when calling super().__init__.

One solution is to call super().__init__() with the same arguments, and override __str__; another would be to override __reduce__.

@Zac-HD Zac-HD added the interop how to play nicely with other packages label Aug 1, 2022
@ElectronicRU
Copy link
Author

Wow, quick work! I doff my hat :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interop how to play nicely with other packages
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants