File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change
1
+ import duckdb
2
+ import os
3
+ import pytest
4
+
5
+ # Get a fresh connection to DuckDB with the community extension binary loaded
6
+ @pytest .fixture
7
+ def duckdb_conn ():
8
+ extension_binary = os .getenv ('HTTPSERVER_EXTENSION_BINARY_PATH' )
9
+ if (extension_binary == '' ):
10
+ raise Exception ('Please make sure the `HTTPSERVER_EXTENSION_BINARY_PATH` is set to run the python tests' )
11
+ conn = duckdb .connect ('' , config = {'allow_unsigned_extensions' : 'true' })
12
+ conn .execute (f"load '{ extension_binary } '" )
13
+ return conn
14
+
15
+ def test_quack (duckdb_conn ):
16
+ duckdb_conn .execute ("SELECT httpserve_start('0.0.0.0', 8123, '');" );
17
+ res = duckdb_conn .fetchall ()
18
+ assert (res [0 ][0 ] == "HTTP server started on 0.0.0.0:8123" );
19
+
20
+ def test_quack (duckdb_conn ):
21
+ duckdb_conn .execute ("SELECT * FROM read_json_auto('http://localhost:8123/?q=SELECT 1');" );
22
+ res = duckdb_conn .fetchall ()
23
+ assert (res [0 ][0 ] == "1" );
You can’t perform that action at this time.
0 commit comments