Skip to content

Commit b772582

Browse files
committed
self review
1 parent 0c63629 commit b772582

File tree

4 files changed

+5
-6
lines changed

4 files changed

+5
-6
lines changed

src/reactpy/reactjs/module.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
from reactpy.reactjs.utils import (
1212
are_files_identical,
1313
copy_file,
14+
file_lock,
1415
module_name_suffix,
1516
resolve_from_module_file,
1617
resolve_from_module_url,
17-
simple_file_lock,
1818
)
1919
from reactpy.types import ImportSourceDict, JavaScriptModule, VdomConstructor
2020

@@ -56,7 +56,7 @@ def file_to_module(
5656
source_file = Path(file).resolve()
5757
target_file = get_module_path(name)
5858

59-
with simple_file_lock(target_file.with_name(target_file.name + ".lock")):
59+
with file_lock(target_file.with_name(f"{target_file.name}.lock")):
6060
if not source_file.exists():
6161
msg = f"Source file does not exist: {source_file}"
6262
raise FileNotFoundError(msg)

src/reactpy/reactjs/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ def copy_file(target: Path, source: Path, symlink: bool) -> None:
204204

205205

206206
@contextmanager
207-
def simple_file_lock(lock_file: Path, timeout: float = 10.0):
207+
def file_lock(lock_file: Path, timeout: float = 10.0):
208208
start_time = time.time()
209209
while True:
210210
try:

src/reactpy/testing/display.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ async def __aenter__(self) -> DisplayFixture:
6767
return self
6868

6969
async def configure_page(self) -> None:
70-
"""Hook for configuring the page before use."""
7170
if getattr(self, "page", None) is None:
7271
self.page = await self.browser.new_page()
7372
self.page.set_default_timeout(REACTPY_TESTS_DEFAULT_TIMEOUT.current * 1000)

tests/test_reactjs/test_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66

77
from reactpy.reactjs.utils import (
88
copy_file,
9+
file_lock,
910
module_name_suffix,
1011
normalize_url_path,
1112
resolve_from_module_file,
1213
resolve_from_module_source,
1314
resolve_from_module_url,
14-
simple_file_lock,
1515
)
1616
from reactpy.testing import assert_reactpy_did_log
1717

@@ -196,5 +196,5 @@ def test_simple_file_lock_timeout(tmp_path):
196196
with patch("os.open", side_effect=OSError):
197197
with patch("time.sleep"): # Speed up test
198198
with pytest.raises(TimeoutError, match="Could not acquire lock"):
199-
with simple_file_lock(lock_file, timeout=0.1):
199+
with file_lock(lock_file, timeout=0.1):
200200
pass

0 commit comments

Comments
 (0)