hypothesis 6.135.18__tar.gz → 6.135.19__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. {hypothesis-6.135.18 → hypothesis-6.135.19}/PKG-INFO +1 -1
  2. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/core.py +9 -5
  3. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/internal/entropy.py +5 -3
  4. hypothesis-6.135.19/src/hypothesis/utils/threading.py +44 -0
  5. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/version.py +1 -1
  6. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis.egg-info/PKG-INFO +1 -1
  7. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis.egg-info/SOURCES.txt +1 -0
  8. {hypothesis-6.135.18 → hypothesis-6.135.19}/LICENSE.txt +0 -0
  9. {hypothesis-6.135.18 → hypothesis-6.135.19}/README.md +0 -0
  10. {hypothesis-6.135.18 → hypothesis-6.135.19}/pyproject.toml +0 -0
  11. {hypothesis-6.135.18 → hypothesis-6.135.19}/setup.cfg +0 -0
  12. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/_hypothesis_ftz_detector.py +0 -0
  13. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/_hypothesis_globals.py +0 -0
  14. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/_hypothesis_pytestplugin.py +0 -0
  15. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/__init__.py +0 -0
  16. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/_settings.py +0 -0
  17. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/configuration.py +0 -0
  18. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/control.py +0 -0
  19. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/database.py +0 -0
  20. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/entry_points.py +0 -0
  21. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/errors.py +0 -0
  22. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/extra/__init__.py +0 -0
  23. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/extra/_array_helpers.py +0 -0
  24. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/extra/_patching.py +0 -0
  25. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/extra/array_api.py +0 -0
  26. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/extra/cli.py +0 -0
  27. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/extra/codemods.py +0 -0
  28. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/extra/dateutil.py +0 -0
  29. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/extra/django/__init__.py +0 -0
  30. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/extra/django/_fields.py +0 -0
  31. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/extra/django/_impl.py +0 -0
  32. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/extra/dpcontracts.py +0 -0
  33. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/extra/ghostwriter.py +0 -0
  34. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/extra/lark.py +0 -0
  35. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/extra/numpy.py +0 -0
  36. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/extra/pandas/__init__.py +0 -0
  37. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/extra/pandas/impl.py +0 -0
  38. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/extra/pytestplugin.py +0 -0
  39. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/extra/pytz.py +0 -0
  40. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/extra/redis.py +0 -0
  41. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/internal/__init__.py +0 -0
  42. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/internal/cache.py +0 -0
  43. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/internal/cathetus.py +0 -0
  44. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/internal/charmap.py +0 -0
  45. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/internal/compat.py +0 -0
  46. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/internal/conjecture/__init__.py +0 -0
  47. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/internal/conjecture/choice.py +0 -0
  48. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/internal/conjecture/data.py +0 -0
  49. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/internal/conjecture/datatree.py +0 -0
  50. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/internal/conjecture/dfa/__init__.py +0 -0
  51. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/internal/conjecture/dfa/lstar.py +0 -0
  52. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/internal/conjecture/engine.py +0 -0
  53. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/internal/conjecture/floats.py +0 -0
  54. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/internal/conjecture/junkdrawer.py +0 -0
  55. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/internal/conjecture/optimiser.py +0 -0
  56. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/internal/conjecture/pareto.py +0 -0
  57. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/internal/conjecture/provider_conformance.py +0 -0
  58. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/internal/conjecture/providers.py +0 -0
  59. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/internal/conjecture/shrinker.py +0 -0
  60. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/internal/conjecture/shrinking/__init__.py +0 -0
  61. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/internal/conjecture/shrinking/bytes.py +0 -0
  62. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/internal/conjecture/shrinking/choicetree.py +0 -0
  63. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/internal/conjecture/shrinking/collection.py +0 -0
  64. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/internal/conjecture/shrinking/common.py +0 -0
  65. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/internal/conjecture/shrinking/floats.py +0 -0
  66. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/internal/conjecture/shrinking/integer.py +0 -0
  67. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/internal/conjecture/shrinking/ordering.py +0 -0
  68. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/internal/conjecture/shrinking/string.py +0 -0
  69. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/internal/conjecture/utils.py +0 -0
  70. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/internal/constants_ast.py +0 -0
  71. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/internal/coverage.py +0 -0
  72. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/internal/detection.py +0 -0
  73. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/internal/escalation.py +0 -0
  74. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/internal/filtering.py +0 -0
  75. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/internal/floats.py +0 -0
  76. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/internal/healthcheck.py +0 -0
  77. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/internal/intervalsets.py +0 -0
  78. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/internal/observability.py +0 -0
  79. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/internal/reflection.py +0 -0
  80. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/internal/scrutineer.py +0 -0
  81. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/internal/validation.py +0 -0
  82. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/provisional.py +0 -0
  83. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/py.typed +0 -0
  84. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/reporting.py +0 -0
  85. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/stateful.py +0 -0
  86. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/statistics.py +0 -0
  87. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/strategies/__init__.py +0 -0
  88. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/strategies/_internal/__init__.py +0 -0
  89. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/strategies/_internal/attrs.py +0 -0
  90. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/strategies/_internal/collections.py +0 -0
  91. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/strategies/_internal/core.py +0 -0
  92. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/strategies/_internal/datetime.py +0 -0
  93. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/strategies/_internal/deferred.py +0 -0
  94. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/strategies/_internal/featureflags.py +0 -0
  95. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/strategies/_internal/flatmapped.py +0 -0
  96. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/strategies/_internal/functions.py +0 -0
  97. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/strategies/_internal/ipaddress.py +0 -0
  98. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/strategies/_internal/lazy.py +0 -0
  99. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/strategies/_internal/misc.py +0 -0
  100. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/strategies/_internal/numbers.py +0 -0
  101. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/strategies/_internal/random.py +0 -0
  102. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/strategies/_internal/recursive.py +0 -0
  103. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/strategies/_internal/regex.py +0 -0
  104. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/strategies/_internal/shared.py +0 -0
  105. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/strategies/_internal/strategies.py +0 -0
  106. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/strategies/_internal/strings.py +0 -0
  107. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/strategies/_internal/types.py +0 -0
  108. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/strategies/_internal/utils.py +0 -0
  109. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/utils/__init__.py +0 -0
  110. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/utils/conventions.py +0 -0
  111. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/utils/dynamicvariables.py +0 -0
  112. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/utils/terminal.py +0 -0
  113. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/vendor/__init__.py +0 -0
  114. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/vendor/pretty.py +0 -0
  115. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis/vendor/tlds-alpha-by-domain.txt +0 -0
  116. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis.egg-info/dependency_links.txt +0 -0
  117. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis.egg-info/entry_points.txt +0 -0
  118. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis.egg-info/requires.txt +0 -0
  119. {hypothesis-6.135.18 → hypothesis-6.135.19}/src/hypothesis.egg-info/top_level.txt +0 -0
  120. {hypothesis-6.135.18 → hypothesis-6.135.19}/tests/test_annotated_types.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hypothesis
3
- Version: 6.135.18
3
+ Version: 6.135.19
4
4
  Summary: A library for property-based testing
5
5
  Author-email: "David R. MacIver and Zac Hatfield-Dodds" <david@drmaciver.com>
6
6
  License-Expression: MPL-2.0
@@ -140,6 +140,7 @@ from hypothesis.strategies._internal.strategies import (
140
140
  SearchStrategy,
141
141
  check_strategy,
142
142
  )
143
+ from hypothesis.utils.threading import ThreadLocal
143
144
  from hypothesis.vendor.pretty import RepresentationPrinter
144
145
  from hypothesis.version import __version__
145
146
 
@@ -149,7 +150,11 @@ TestFunc = TypeVar("TestFunc", bound=Callable)
149
150
  running_under_pytest = False
150
151
  pytest_shows_exceptiongroups = True
151
152
  global_force_seed = None
152
- _hypothesis_global_random = None
153
+ # `threadlocal` stores "engine-global" constants, which are global relative to a
154
+ # ConjectureRunner instance (roughly speaking). Since only one conjecture runner
155
+ # instance can be active per thread, making engine constants thread-local prevents
156
+ # the ConjectureRunner instances of concurrent threads from treading on each other.
157
+ threadlocal = ThreadLocal(_hypothesis_global_random=None)
153
158
 
154
159
 
155
160
  @dataclass
@@ -703,10 +708,9 @@ def get_random_for_wrapped_test(test, wrapped_test):
703
708
  elif global_force_seed is not None:
704
709
  return Random(global_force_seed)
705
710
  else:
706
- global _hypothesis_global_random
707
- if _hypothesis_global_random is None: # pragma: no cover
708
- _hypothesis_global_random = Random()
709
- seed = _hypothesis_global_random.getrandbits(128)
711
+ if threadlocal._hypothesis_global_random is None: # pragma: no cover
712
+ threadlocal._hypothesis_global_random = Random()
713
+ seed = threadlocal._hypothesis_global_random.getrandbits(128)
710
714
  wrapped_test._hypothesis_internal_use_generated_seed = seed
711
715
  return Random(seed)
712
716
 
@@ -195,9 +195,11 @@ def deterministic_PRNG(seed: int = 0) -> Generator[None, None, None]:
195
195
  bad idea in principle, and breaks all kinds of independence assumptions
196
196
  in practice.
197
197
  """
198
- if hypothesis.core._hypothesis_global_random is None: # pragma: no cover
199
- hypothesis.core._hypothesis_global_random = random.Random()
200
- register_random(hypothesis.core._hypothesis_global_random)
198
+ if (
199
+ hypothesis.core.threadlocal._hypothesis_global_random is None
200
+ ): # pragma: no cover
201
+ hypothesis.core.threadlocal._hypothesis_global_random = random.Random()
202
+ register_random(hypothesis.core.threadlocal._hypothesis_global_random)
201
203
 
202
204
  seed_all, restore_all = get_seeder_and_restorer(seed)
203
205
  seed_all()
@@ -0,0 +1,44 @@
1
+ # This file is part of Hypothesis, which may be found at
2
+ # https://github.com/HypothesisWorks/hypothesis/
3
+ #
4
+ # Copyright the Hypothesis Authors.
5
+ # Individual contributors are listed in AUTHORS.rst and the git log.
6
+ #
7
+ # This Source Code Form is subject to the terms of the Mozilla Public License,
8
+ # v. 2.0. If a copy of the MPL was not distributed with this file, You can
9
+ # obtain one at https://mozilla.org/MPL/2.0/.
10
+
11
+ import threading
12
+ from typing import Any
13
+
14
+
15
+ class ThreadLocal:
16
+ """
17
+ Manages thread-local state. ThreadLocal forwards getattr and setattr to a
18
+ threading.local() instance. The passed kwargs defines the available attributes
19
+ on the threadlocal and their default values.
20
+
21
+ The only supported names to geattr and setattr are the keys of the passed kwargs.
22
+ """
23
+
24
+ def __init__(self, **kwargs: Any) -> None:
25
+ self.__initialized = False
26
+ self.__kwargs = kwargs
27
+ self.__threadlocal = threading.local()
28
+ self.__initialized = True
29
+
30
+ def __getattr__(self, name: str) -> Any:
31
+ if name not in self.__kwargs:
32
+ raise AttributeError(f"No attribute {name}")
33
+ if not hasattr(self.__threadlocal, name):
34
+ setattr(self.__threadlocal, name, self.__kwargs[name])
35
+ return getattr(self.__threadlocal, name)
36
+
37
+ def __setattr__(self, name: str, value: Any) -> None:
38
+ # disable attribute-forwarding while initializing
39
+ if "_ThreadLocal__initialized" not in self.__dict__ or not self.__initialized:
40
+ super().__setattr__(name, value)
41
+ else:
42
+ if name not in self.__kwargs:
43
+ raise AttributeError(f"No attribute {name}")
44
+ setattr(self.__threadlocal, name, value)
@@ -8,5 +8,5 @@
8
8
  # v. 2.0. If a copy of the MPL was not distributed with this file, You can
9
9
  # obtain one at https://mozilla.org/MPL/2.0/.
10
10
 
11
- __version_info__ = (6, 135, 18)
11
+ __version_info__ = (6, 135, 19)
12
12
  __version__ = ".".join(map(str, __version_info__))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hypothesis
3
- Version: 6.135.18
3
+ Version: 6.135.19
4
4
  Summary: A library for property-based testing
5
5
  Author-email: "David R. MacIver and Zac Hatfield-Dodds" <david@drmaciver.com>
6
6
  License-Expression: MPL-2.0
@@ -111,6 +111,7 @@ src/hypothesis/utils/__init__.py
111
111
  src/hypothesis/utils/conventions.py
112
112
  src/hypothesis/utils/dynamicvariables.py
113
113
  src/hypothesis/utils/terminal.py
114
+ src/hypothesis/utils/threading.py
114
115
  src/hypothesis/vendor/__init__.py
115
116
  src/hypothesis/vendor/pretty.py
116
117
  src/hypothesis/vendor/tlds-alpha-by-domain.txt
File without changes
File without changes
File without changes