Security News
Introducing the Socket Python SDK
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
A pytest plugin to record HTTP(S) requests with stack trace.
pip install pytest-httpdbg
--httpdbg record HTTP(S) requests
--httpdbg-dir=HTTPDBG_DIR
save httpdbg traces in a directory
--httpdbg-no-clean do not clean the httpdbg directory
--httpdbg-initiator=HTTPDBG_INITIATOR
add a new initiator (package) for httpdbg
Enables the record of the HTTP requests.
Indicates where to save the log files.
Does not clean existing log files if the log directory is not empty.
An initiator is the function/method that is at the origin of the HTTP requests. By default, we already support some packages but you can add your own initiators.
To add a new package in the list of initiators, you can use the http-initiator
command line argument.
You can use any package as an initiator, this is not limited to HTTP requests.
When the test is finished (teardown step included), one log file in markdown format is written. The path to this log file is stashed in the item when the test starts (before the setup step), even if the file not exists yet.
You can copy the following code in your top-level conftest.py
to include the logs into your pytest-html report.
import os
import pytest
from pytest_httpdbg import httpdbg_record_filename
@pytest.hookimpl(hookwrapper=True)
def pytest_runtest_makereport(item, call):
pytest_html = item.config.pluginmanager.getplugin("html")
outcome = yield
report = outcome.get_result()
extras = getattr(report, "extras", [])
if call.when == "call":
if httpdbg_record_filename in item.stash:
extras.append(
pytest_html.extras.url(
os.path.basename(item.stash[httpdbg_record_filename]),
name="HTTPDBG",
)
)
report.extras = extras
This example works if you use the same directory for the html test report file and the httpdbg logs.
pytest demo/ --httpdbg --httpdbg-dir report --html=report/report.html
If this is not the case, you must adapt it to your configuration.
FAQs
A pytest plugin to record HTTP(S) requests with stack trace
We found that pytest-httpdbg demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.
Security News
A new Rust RFC proposes "Trusted Publishing" for Crates.io, introducing short-lived access tokens via OIDC to improve security and reduce risks associated with long-lived API tokens.