1 from datasette.app import Datasette
8 @pytest.fixture(scope='session')
9 def app_client(max_returned_rows=None):
10 with tempfile.TemporaryDirectory() as tmpdir:
11 filepath = os.path.join(tmpdir, 'test_tables.h5')
12 populate_file(filepath)
16 'default_page_size': 50,
17 'max_returned_rows': max_returned_rows or 1000,
20 client = ds.app().test_client
24 def populate_file(filepath):
25 class Particle(IsDescription):
26 identity = StringCol(itemsize=22, dflt=' ', pos=0)
27 idnumber = Int16Col(dflt=1, pos=1)
28 speed = Float32Col(dflt=1, pos=2)
30 h5file = open_file(filepath, mode='w')
33 group1 = h5file.create_group(root, 'group1')
34 group2 = h5file.create_group(root, 'group2')
36 array1 = h5file.create_array(root, 'array1', ['string', 'array'])
38 table1 = h5file.create_table(group1, 'table1', Particle)
39 table2 = h5file.create_table(group2, 'table2', Particle)
41 array2 = h5file.create_array(group1, 'array2', [x for x in range(10000)])
43 multiarray = h5file.create_array(group2, 'multi', np.arange(1000).reshape(10, 50, 2))
45 for table in (table1, table2):
48 for i in range(10000):
49 row['identity'] = 'This is particle: %2d' % (i)