summaryrefslogtreecommitdiffstats
path: root/contrib/python/hypothesis/py3/_hypothesis_globals.py
diff options
context:
space:
mode:
authorAlexander Smirnov <[email protected]>2024-01-31 17:22:33 +0300
committerAlexander Smirnov <[email protected]>2024-01-31 17:22:33 +0300
commit52be5dbdd420165c68e7e90ba8f1d2f00da041f6 (patch)
tree5d47f5b2ff4e6a7c8e75d33931a1e683949b7229 /contrib/python/hypothesis/py3/_hypothesis_globals.py
parentea57c8867ceca391357c3c5ffcc5ba6738b49adc (diff)
parent809f0cf2fdfddfbeacc2256ffdbaaf5808ce5ed4 (diff)
Merge branch 'mergelibs12' into main
Diffstat (limited to 'contrib/python/hypothesis/py3/_hypothesis_globals.py')
-rw-r--r--contrib/python/hypothesis/py3/_hypothesis_globals.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/contrib/python/hypothesis/py3/_hypothesis_globals.py b/contrib/python/hypothesis/py3/_hypothesis_globals.py
new file mode 100644
index 00000000000..e97e0918795
--- /dev/null
+++ b/contrib/python/hypothesis/py3/_hypothesis_globals.py
@@ -0,0 +1,28 @@
+# This file is part of Hypothesis, which may be found at
+# https://github.com/HypothesisWorks/hypothesis/
+#
+# Copyright the Hypothesis Authors.
+# Individual contributors are listed in AUTHORS.rst and the git log.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public License,
+# v. 2.0. If a copy of the MPL was not distributed with this file, You can
+# obtain one at https://mozilla.org/MPL/2.0/.
+
+"""
+Module for globals shared between plugin(s) and the main hypothesis module, without
+depending on either. This file should have no imports outside of stdlib.
+"""
+
+import os
+
+in_initialization = 1
+"""If nonzero, indicates that hypothesis is still initializing (importing or loading
+the test environment). `import hypothesis` will cause this number to be decremented,
+and the pytest plugin increments at load time, then decrements it just before the test
+session starts. However, this leads to a hole in coverage if another pytest plugin
+imports hypothesis before our plugin is loaded. HYPOTHESIS_EXTEND_INITIALIZATION may
+be set to pre-increment the value on behalf of _hypothesis_pytestplugin, plugging the
+hole."""
+
+if os.environ.get("HYPOTHESIS_EXTEND_INITIALIZATION"):
+ in_initialization += 1