1 from datasette_connectors import monkey; monkey.patch_datasette()
2 from datasette_connectors import connectors; connectors.load()
4 from datasette.app import Datasette
11 @pytest.fixture(scope='session')
12 def app_client(max_returned_rows=None):
13 with tempfile.TemporaryDirectory() as tmpdir:
14 filepath = os.path.join(tmpdir, 'test_tables.h5')
15 populate_file(filepath)
19 'default_page_size': 50,
20 'max_returned_rows': max_returned_rows or 1000,
23 client = ds.app().test_client
27 def populate_file(filepath):
28 class Particle(IsDescription):
29 identity = StringCol(itemsize=22, dflt=' ', pos=0)
30 idnumber = Int16Col(dflt=1, pos=1)
31 speed = Float32Col(dflt=1, pos=2)
33 h5file = open_file(filepath, mode='w')
36 group1 = h5file.create_group(root, 'group1')
37 group2 = h5file.create_group(root, 'group2')
39 array1 = h5file.create_array(root, 'array1', ['string', 'array'])
41 table1 = h5file.create_table(group1, 'table1', Particle)
42 table2 = h5file.create_table(group2, 'table2', Particle)
44 array2 = h5file.create_array(group1, 'array2', [x for x in range(10000)])
46 multiarray = h5file.create_array(group2, 'multi', np.arange(1000).reshape(10, 50, 2))
48 for table in (table1, table2):
51 for i in range(10000):
52 row['identity'] = 'This is particle: %2d' % (i)