File: test_http_logging.py

package info (click to toggle)
duckdb 1.5.1-3
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 299,196 kB
  • sloc: cpp: 865,414; ansic: 57,292; python: 18,871; sql: 12,663; lisp: 11,751; yacc: 7,412; lex: 1,682; sh: 747; makefile: 564
file content (27 lines) | stat: -rw-r--r-- 791 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# fmt: off

import pytest
import subprocess
import sys
from typing import List
from conftest import ShellTest
import os

@pytest.mark.skip(reason="Skip after File Logging rework")
def test_http_logging_file(shell, tmp_path):
    temp_dir = tmp_path / 'http_logging_dir'
    temp_dir.mkdir()
    temp_file = temp_dir / 'myfile'

    test = (
        ShellTest(shell)
        .statement("SET enable_http_logging=true;")
        .statement(f"SET http_logging_output='{temp_file.as_posix()}'")
        .statement("install 'http://extensions.duckdb.org/v0.10.1/osx_arm64/httpfs.duckdb_extension.gzzz';")
    )
    result = test.run()

    with open(temp_file, 'r') as f:
        file_content = f.read()
        assert "HTTP Request" in file_content
        assert "HTTP Response" in file_content