Download tests/test_persistence.py from BurnyCoder/trigintaduonion-neural-network: direct link, hf CLI and curl.
- Browser
- Download file 722 Bytes
-
https://huggingface.co/BurnyCoder/trigintaduonion-neural-network/resolve/main/tests/test_persistence.py
- Command line
-
hf download hf://BurnyCoder/trigintaduonion-neural-network/tests/test_persistence.py
-
curl -L -o test_persistence.py https://huggingface.co/BurnyCoder/trigintaduonion-neural-network/resolve/main/tests/test_persistence.py
722 Bytes
| """Check the real Windows reader/atomic-replace failure observed with the live monitor.""" | |
| from trig32 import paths | |
| def test_reader_share_retry(tmp_path,monkeypatch): | |
| destination=tmp_path/"live.json" | |
| destination.write_text("old") | |
| original=paths.os.replace | |
| calls=[] | |
| def transient(source,dest): | |
| calls.append(dest) | |
| if len(calls)==1: | |
| error=PermissionError("temporarily shared by monitor") | |
| error.winerror=32 | |
| raise error | |
| original(source,dest) | |
| monkeypatch.setattr(paths.os,"replace",transient) | |
| paths.write_json(destination,{"epoch":6}) | |
| assert len(calls)==2 and paths.json.loads(destination.read_text())=={"epoch":6} | |