retry: Don't call into closed plugin
[nbdkit/ericb.git] / tests / test.py
blob9a2e947ddcd2717045cb53c4d273392c281dae86
1 import nbdkit
3 disk = bytearray(1024*1024)
6 def config_complete():
7 print ("set_error = %r" % nbdkit.set_error)
10 def open(readonly):
11 return 1
14 def get_size(h):
15 global disk
16 return len(disk)
19 def can_write(h):
20 return True
23 def can_flush(h):
24 return True
27 def is_rotational(h):
28 return False
31 def can_trim(h):
32 return True
35 def pread(h, count, offset):
36 global disk
37 return disk[offset:offset+count]
40 def pwrite(h, buf, offset):
41 global disk
42 end = offset + len(buf)
43 disk[offset:end] = buf
46 def zero(h, count, offset, may_trim=False):
47 global disk
48 disk[offset:offset+count] = bytearray(count)
51 def flush(h):
52 pass
55 def trim(h, count, offset):
56 pass