(dir_server)
| 109 | |
| 110 | |
| 111 | def test_ops_blocksize(dir_server): |
| 112 | root = "http://localhost:8999/" |
| 113 | fn = files[0] |
| 114 | f = open_files(root + fn, block_size=2)[0] |
| 115 | with open(os.path.join(dir_server, fn), "rb") as expected: |
| 116 | expected = expected.read() |
| 117 | with f as f: |
| 118 | # it's OK to read the whole file |
| 119 | assert f.read() == expected |
| 120 | # and now the file magically has a size |
| 121 | assert f.size == len(expected) |
| 122 | |
| 123 | # note that if we reuse f from above, because it is tokenized, we get |
| 124 | # the same open file - where is this cached? |
| 125 | fn = files[1] |
| 126 | f = open_files(root + fn, block_size=2)[0] |
| 127 | with f as f: |
| 128 | if Version(fsspec.__version__) < Version("2021.11.1"): |
| 129 | # fails because we want only 12 bytes |
| 130 | with pytest.raises(ValueError): |
| 131 | assert f.read(10) == expected[:10] |
| 132 | else: |
| 133 | # fixed in https://github.com/fsspec/filesystem_spec/pull/830 |
| 134 | assert f.read(10) == expected[:10] |
| 135 | |
| 136 | |
| 137 | def test_errors(dir_server): |
nothing calls this directly
no test coverage detected
searching dependent graphs…