MCPcopy
hub / github.com/mosaicml/composer / test_get_file_auto_object_store

Function test_get_file_auto_object_store

tests/utils/test_file_helpers.py:77–88  ·  view source on GitHub ↗
(tmp_path: pathlib.Path, monkeypatch: pytest.MonkeyPatch)

Source from the content-addressed store, hash-verified

75
76
77def test_get_file_auto_object_store(tmp_path: pathlib.Path, monkeypatch: pytest.MonkeyPatch):
78 with patch('composer.utils.file_helpers.S3ObjectStore', DummyObjectStore):
79 object_store = DummyObjectStore(pathlib.Path('my-test-bucket'))
80 with open(str(tmp_path / 'test-file.txt'), 'w') as _txt_file:
81 _txt_file.write('testing')
82 object_store.upload_object('test-file.txt', str(tmp_path / 'test-file.txt'))
83 get_file(f's3://my-test-bucket/test-file.txt', str(tmp_path / 'loaded-test-file.txt'))
84
85 with open(str(tmp_path / 'loaded-test-file.txt')) as _txt_file:
86 loaded_content = _txt_file.read()
87
88 assert loaded_content.startswith('testing')
89
90
91def test_get_file_object_store_with_symlink(tmp_path: pathlib.Path, monkeypatch: pytest.MonkeyPatch):

Callers

nothing calls this directly

Calls 4

upload_objectMethod · 0.95
DummyObjectStoreClass · 0.90
get_fileFunction · 0.90
writeMethod · 0.45

Tested by

no test coverage detected