mirror of
https://github.com/explosion/spaCy.git
synced 2025-08-07 21:54:54 +03:00
Run tests with one and two remote files with the same command hash
This commit is contained in:
parent
bbda5f9d90
commit
ee9f7ce232
|
@ -861,18 +861,43 @@ def test_span_length_freq_dist_output_must_be_correct():
|
||||||
def test_local_remote_storage():
|
def test_local_remote_storage():
|
||||||
with make_tempdir() as d:
|
with make_tempdir() as d:
|
||||||
filename = "a.txt"
|
filename = "a.txt"
|
||||||
content = "newer context"
|
content = "older context"
|
||||||
|
|
||||||
loc_file = d / "root" / filename
|
loc_file = d / "root" / filename
|
||||||
loc_file.parent.mkdir(parents=True)
|
loc_file.parent.mkdir(parents=True)
|
||||||
with loc_file.open(mode="w") as file_:
|
with loc_file.open(mode="w") as file_:
|
||||||
file_.write("older content")
|
file_.write(content)
|
||||||
|
|
||||||
# push first version to remote storage
|
# push first version to remote storage
|
||||||
remote = RemoteStorage(d / "root", str(d / "remote"))
|
remote = RemoteStorage(d / "root", str(d / "remote"))
|
||||||
remote.push(filename, "aaaa", "aaaa")
|
remote.push(filename, "aaaa", "aaaa")
|
||||||
|
|
||||||
|
# retrieve with full hashes
|
||||||
|
loc_file.unlink()
|
||||||
|
remote.pull(filename, command_hash="aaaa", content_hash="aaaa")
|
||||||
|
with loc_file.open(mode="r") as file_:
|
||||||
|
assert file_.read() == content
|
||||||
|
|
||||||
|
# retrieve with command hash
|
||||||
|
loc_file.unlink()
|
||||||
|
remote.pull(filename, command_hash="aaaa")
|
||||||
|
with loc_file.open(mode="r") as file_:
|
||||||
|
assert file_.read() == content
|
||||||
|
|
||||||
|
# retrieve with content hash
|
||||||
|
loc_file.unlink()
|
||||||
|
remote.pull(filename, content_hash="aaaa")
|
||||||
|
with loc_file.open(mode="r") as file_:
|
||||||
|
assert file_.read() == content
|
||||||
|
|
||||||
|
# retrieve with no hashes
|
||||||
|
loc_file.unlink()
|
||||||
|
remote.pull(filename)
|
||||||
|
with loc_file.open(mode="r") as file_:
|
||||||
|
assert file_.read() == content
|
||||||
|
|
||||||
# push second version to remote storage
|
# push second version to remote storage
|
||||||
|
content = "newer content"
|
||||||
with loc_file.open(mode="w") as file_:
|
with loc_file.open(mode="w") as file_:
|
||||||
file_.write(content)
|
file_.write(content)
|
||||||
remote.push(filename, "aaaa", "bbbb")
|
remote.push(filename, "aaaa", "bbbb")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user