(request, tmpdir)
| 1072 | |
| 1073 | @pytest.fixture |
| 1074 | def sample_disk_data(request, tmpdir): |
| 1075 | SIZE = 4096 |
| 1076 | arr = [random.randint(0, 255) for _ in range(SIZE)] |
| 1077 | data = bytes(arr[:SIZE]) |
| 1078 | |
| 1079 | path = os.path.join(str(tmpdir), guid()) |
| 1080 | |
| 1081 | with open(path, 'wb') as f: |
| 1082 | f.write(data) |
| 1083 | |
| 1084 | def teardown(): |
| 1085 | _try_delete(path) |
| 1086 | |
| 1087 | request.addfinalizer(teardown) |
| 1088 | return path, data |
| 1089 | |
| 1090 | |
| 1091 | def _check_native_file_reader(FACTORY, sample_data, |