File: test_thread_type.py

package info (click to toggle)
pytest-httpserver 1.1.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 908 kB
  • sloc: python: 2,382; makefile: 77; sh: 21
file content (21 lines) | stat: -rw-r--r-- 528 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from __future__ import annotations

import threading
from typing import TYPE_CHECKING

import requests
from werkzeug import Response

if TYPE_CHECKING:
    from werkzeug import Request

    from pytest_httpserver import HTTPServer


def test_server_thread_is_daemon(httpserver: HTTPServer):
    def handler(_request: Request):
        return Response(f"{threading.current_thread().daemon}")

    httpserver.expect_request("/foo").respond_with_handler(handler)

    assert requests.get(httpserver.url_for("/foo")).text == "True"