fix: publish collection history atomically
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
"""Timezone detection tests."""
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).parent.parent / "src"))
|
||||
|
||||
from fenris import tz_util
|
||||
|
||||
|
||||
def test_relative_localtime_symlink_returns_zoneinfo_key(tmp_path, monkeypatch):
|
||||
zoneinfo = tmp_path / "usr" / "share" / "zoneinfo" / "Asia" / "Kolkata"
|
||||
zoneinfo.parent.mkdir(parents=True)
|
||||
zoneinfo.write_bytes(b"zoneinfo")
|
||||
localtime = tmp_path / "etc" / "localtime"
|
||||
localtime.parent.mkdir()
|
||||
localtime.symlink_to("../usr/share/zoneinfo/Asia/Kolkata")
|
||||
|
||||
real_path = tz_util.Path
|
||||
monkeypatch.setattr(
|
||||
tz_util,
|
||||
"Path",
|
||||
lambda path: localtime if path == "/etc/localtime" else real_path(path),
|
||||
)
|
||||
monkeypatch.delenv("TZ", raising=False)
|
||||
|
||||
assert tz_util.detect_system_tz() == "Asia/Kolkata"
|
||||
Reference in New Issue
Block a user