diff --git a/pyproject.toml b/pyproject.toml index 0cc4c7d..9baedc1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,7 @@ name = "pytest-httpdbg" authors = [ {name = "cle-b", email = "cle@tictac.pm"}, ] -description="A pytest plugin to record HTTP(S) requests with stack trace" +description="A pytest plugin to record HTTP(S) requests with stack trace." readme="README.md" requires-python = ">=3.9.0" license = {text = "Apache-2.0"} @@ -24,7 +24,7 @@ classifiers = [ ] dynamic = ["version"] dependencies = [ - "httpdbg>=0.29.0", + "httpdbg>=0.32.0", "pytest>=7.0.0" ] diff --git a/pytest_httpdbg/__init__.py b/pytest_httpdbg/__init__.py index 6afad9b..3455bfb 100644 --- a/pytest_httpdbg/__init__.py +++ b/pytest_httpdbg/__init__.py @@ -1,4 +1,4 @@ # -*- coding: utf-8 -*- from pytest_httpdbg.plugin import httpdbg_record_filename # noqa F401 -__version__ = "0.6.1" +__version__ = "0.7.0" diff --git a/pytest_httpdbg/plugin.py b/pytest_httpdbg/plugin.py index 69f0597..f3fe923 100644 --- a/pytest_httpdbg/plugin.py +++ b/pytest_httpdbg/plugin.py @@ -1,10 +1,8 @@ # -*- coding: utf-8 -*- import glob import os -import pickle import time from typing import Optional -import uuid import pytest @@ -100,10 +98,7 @@ def pytest_configure(config): @pytest.hookimpl(hookwrapper=True) def pytest_runtest_protocol(item: pytest.Item, nextitem: Optional[pytest.Item]): - if item.config.option.httpdbg or ( - ("HTTPDBG_SUBPROCESS_DIR" in os.environ) - and ("PYTEST_XDIST_WORKER" in os.environ) - ): + if item.config.option.httpdbg: with httprecord(initiators=item.config.option.httpdbg_initiator) as records: # the record of the http requests has been enable using a pytest command line argument # -> first, we stash the path to the log file @@ -118,18 +113,6 @@ def pytest_runtest_protocol(item: pytest.Item, nextitem: Optional[pytest.Item]): yield - # pytest is executed using pyhttpdbg - # -> we serialize the HTTPRecords object to share it with the main pyhttpdbg process - if "HTTPDBG_SUBPROCESS_DIR" in os.environ: - if "PYTEST_XDIST_WORKER" in os.environ: - if len(records.requests) > 0: - fname = f"{os.environ['HTTPDBG_SUBPROCESS_DIR']}/{uuid.uuid1()}" - with open(f"{fname}.httpdbgrecords.tmp", "wb") as f: - pickle.dump(records, f) - os.rename( - f"{fname}.httpdbgrecords.tmp", f"{fname}.httpdbgrecords" - ) - # the record of the http requests has been enable using a pytest command line argument # -> we create a human readable file that contains all the HTTP requests recorded if httpdbg_record_filename in item.stash: