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