(tmp_path: pathlib.Path, monkeypatch: pytest.MonkeyPatch)
| 52 | |
| 53 | |
| 54 | def test_get_file_object_store(tmp_path: pathlib.Path, monkeypatch: pytest.MonkeyPatch): |
| 55 | pytest.importorskip('libcloud') |
| 56 | |
| 57 | remote_dir = tmp_path / 'remote_dir' |
| 58 | os.makedirs(remote_dir) |
| 59 | monkeypatch.setenv('OBJECT_STORE_KEY', str(remote_dir)) # for the local option, the key is the path |
| 60 | provider = LibcloudObjectStore( |
| 61 | provider='local', |
| 62 | key_environ='OBJECT_STORE_KEY', |
| 63 | container='.', |
| 64 | ) |
| 65 | |
| 66 | with open(str(remote_dir / 'checkpoint.txt'), 'wb') as f: |
| 67 | f.write(b'checkpoint1') |
| 68 | get_file( |
| 69 | path='checkpoint.txt', |
| 70 | object_store=provider, |
| 71 | destination=str(tmp_path / 'example'), |
| 72 | ) |
| 73 | with open(str(tmp_path / 'example'), 'rb') as f: |
| 74 | assert f.read() == b'checkpoint1' |
| 75 | |
| 76 | |
| 77 | def test_get_file_auto_object_store(tmp_path: pathlib.Path, monkeypatch: pytest.MonkeyPatch): |
nothing calls this directly
no test coverage detected