Skip to content

Commit 4321469

Browse files
committed
Formatting and cache busting
1 parent 263c044 commit 4321469

File tree

8 files changed

+13
-15
lines changed

8 files changed

+13
-15
lines changed

hypothesis-python/setup.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,11 @@ def local_file(name):
124124
"Topic :: Software Development :: Testing",
125125
"Typing :: Typed",
126126
],
127-
py_modules=["_hypothesis_pytestplugin", "_hypothesis_ftz_detector", "_hypothesis_globals"],
127+
py_modules=[
128+
"_hypothesis_pytestplugin",
129+
"_hypothesis_ftz_detector",
130+
"_hypothesis_globals",
131+
],
128132
entry_points={
129133
"pytest11": ["hypothesispytest = _hypothesis_pytestplugin"],
130134
"console_scripts": ["hypothesis = hypothesis.extra.cli:main"],

hypothesis-python/src/_hypothesis_globals.py

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
import os
1717

18-
1918
in_initialization = 1
2019
"""If nonzero, indicates that hypothesis is still initializing (importing or loading
2120
the test environment). `import hypothesis` will cause this number to be decremented,

hypothesis-python/src/_hypothesis_pytestplugin.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,8 @@
2626
import warnings
2727
from inspect import signature
2828

29-
import pytest
30-
3129
import _hypothesis_globals
30+
import pytest
3231

3332
try:
3433
from _pytest.junitxml import xml_key

hypothesis-python/src/hypothesis/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"""
1717

1818
import _hypothesis_globals
19+
1920
from hypothesis._settings import HealthCheck, Phase, Verbosity, settings
2021
from hypothesis.control import (
2122
assume,

hypothesis-python/src/hypothesis/configuration.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from pathlib import Path
1414

1515
import _hypothesis_globals
16-
import hypothesis
16+
1717
from hypothesis.errors import HypothesisSideeffectWarning
1818

1919
__hypothesis_home_directory_default = Path.cwd() / ".hypothesis"

hypothesis-python/src/hypothesis/database.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -495,8 +495,9 @@ def _prepare_for_io(self) -> None:
495495
self._initialized = True
496496

497497
def _initialize_db(self) -> None:
498+
# Trigger warning that we suppressed earlier by intent_to_write=False
499+
storage_directory(self.path.name)
498500
# Create the cache directory if it doesn't exist
499-
storage_directory(self.path.name) # trigger warning that we suppressed earlier with intent_to_write=False
500501
self.path.mkdir(exist_ok=True, parents=True)
501502

502503
# Get all artifacts

hypothesis-python/src/hypothesis/strategies/_internal/lazy.py

-2
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,11 @@
88
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
99
# obtain one at https://mozilla.org/MPL/2.0/.
1010

11-
import warnings
1211
from inspect import signature
1312
from typing import MutableMapping
1413
from weakref import WeakKeyDictionary
1514

1615
from hypothesis.configuration import check_sideeffect_during_initialization
17-
from hypothesis.errors import HypothesisSideeffectWarning
1816
from hypothesis.internal.reflection import (
1917
convert_keyword_arguments,
2018
convert_positional_arguments,

hypothesis-python/tests/cover/test_sideeffect_warnings.py

+3-7
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,11 @@
88
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
99
# obtain one at https://mozilla.org/MPL/2.0/.
1010

11-
from pathlib import Path
12-
import warnings
13-
11+
import _hypothesis_globals
1412
import pytest
1513

16-
import _hypothesis_globals
17-
from hypothesis import configuration as fs
14+
from hypothesis import configuration as fs, strategies as st
1815
from hypothesis.errors import HypothesisSideeffectWarning
19-
from hypothesis import strategies as st
2016

2117
IN_INITIALIZATION_ATTR = "in_initialization"
2218

@@ -40,7 +36,7 @@ def extend_initialization(monkeypatch):
4036
@pytest.mark.parametrize(
4137
"sideeffect, warning_text",
4238
[
43-
(lambda: st.integers().wrapped_strategy, "lazy evaluation"),
39+
(lambda: st.builds(lambda: None).wrapped_strategy, "lazy evaluation"), # guaranteed not cached
4440
(lambda: st.deferred(st.integers).wrapped_strategy, "deferred evaluation"),
4541
(fs.storage_directory, "accessing storage"),
4642
],

0 commit comments

Comments
 (0)