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

stop the interaction of hypothesis and disttrial from hanging the tests #571

Merged
merged 4 commits into from
Apr 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/klein/test/test_plating.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""


import atexit
import json
from string import printable
from typing import Any
Expand Down Expand Up @@ -147,6 +148,17 @@ def jsonComposites(children):
jsonObjects = st.recursive(jsonAtoms, jsonComposites, max_leaves=200)


@atexit.register
def invalidateJsonStrategy() -> None:
"""
hypothesis RecursiveStrategy hangs on to a threadlocal object which causes
disttrial to hang for some reason.

Possibly related to U{this <https://github.com/python/cpython/pull/28525>}.
"""
jsonObjects.limited_base._threadlocal = None


def transformJSONObject(jsonObject, transformer):
"""
Recursively apply a transforming function to a JSON serializable
Expand Down
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ basepython =
py311: python3.11
pypy3: pypy3
pypy38: pypy3.8
pypy39: pypy3.9

deps = {[default]deps}

Expand Down