Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: "3.10"
python-version: "3.14"
- name: Lint code
run: |
make setup
Expand All @@ -29,9 +29,9 @@ jobs:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: ${{ matrix.python-version }}
- name: Run tests
Expand All @@ -49,9 +49,9 @@ jobs:
id-token: write # IMPORTANT: mandatory for trusted publishing
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: 3.11
- name: Install pypa/build
Expand All @@ -66,7 +66,7 @@ jobs:
github.event_name == 'push' &&
startsWith(github.ref, 'refs/tags') &&
github.actor == github.repository_owner
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: python-package-distributions
path: dist/
Expand All @@ -75,4 +75,4 @@ jobs:
github.event_name == 'push' &&
startsWith(github.ref, 'refs/tags') &&
github.actor == github.repository_owner
uses: pypa/gh-action-pypi-publish@release/v1
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ setup:
pip install -r requirements-dev.txt

format:
black pytest_httpdbg tests
black pytest_httpdbg tests --target-version py39

lint:
black --check pytest_httpdbg tests
black --check pytest_httpdbg tests --target-version py39
flake8 pytest_httpdbg tests

check: lint
Expand Down
2 changes: 1 addition & 1 deletion pytest_httpdbg/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from pytest_httpdbg.plugin import httpdbg_record_filename # noqa F401

__version__ = "0.10.1"
__version__ = "0.10.2"
19 changes: 6 additions & 13 deletions tests/test_allure.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import pytest


confest_py = """
import pytest
import requests
Expand All @@ -26,14 +25,12 @@ def fixture_function(httpbin, fixture_session):
def test_mode_mutual_exclusion(pytester):
pytester.makeconftest(confest_py)

pytester.makepyfile(
"""
pytester.makepyfile("""
import requests

def test_get(httpbin, fixture_session, fixture_function):
requests.get(httpbin.url + "/get")
"""
)
""")

result = pytester.runpytest("--httpdbg", "--httpdbg-allure")

Expand All @@ -49,17 +46,15 @@ def test_get(httpbin, fixture_session, fixture_function):
def test_mode_allure(pytester, tmp_path):
pytester.makeconftest(confest_py)

pytester.makepyfile(
"""
pytester.makepyfile("""
import requests

def test_get(httpbin, fixture_session, fixture_function):
requests.get(httpbin.url + "/get")

def test_post(httpbin, fixture_session, fixture_function):
requests.post(httpbin.url + "/post", json={"a":"b"})
"""
)
""")

result = pytester.runpytest("--httpdbg-allure", f"--alluredir={tmp_path}")

Expand Down Expand Up @@ -92,8 +87,7 @@ def test_post(httpbin, fixture_session, fixture_function):
def test_mode_allure_only_on_failure(pytester, tmp_path):
pytester.makeconftest(confest_py)

pytester.makepyfile(
"""
pytester.makepyfile("""
import requests

def test_pass(httpbin):
Expand All @@ -102,8 +96,7 @@ def test_pass(httpbin):
def test_fail(httpbin):
requests.post(httpbin.url + "/post", json={"a":"b"})
assert False
"""
)
""")

result = pytester.runpytest(
"--httpdbg-allure", f"--alluredir={tmp_path}", "--httpdbg-only-on-failure"
Expand Down
24 changes: 8 additions & 16 deletions tests/test_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,15 @@ def fixture_function(httpbin, fixture_session):
def test_no_httpdbg(pytester):
pytester.makeconftest(confest_py)

pytester.makepyfile(
"""
pytester.makepyfile("""
import requests

def test_get(httpbin, fixture_session, fixture_function):
requests.get(httpbin.url + "/intest")

def test_post(httpbin, fixture_session):
requests.post(httpbin.url + "/intest")
"""
)
""")

result = pytester.runpytest()

Expand All @@ -52,17 +50,15 @@ def test_record_in_dir(pytester, tmp_path):

pytester.makeconftest(confest_py)

pytester.makepyfile(
"""
pytester.makepyfile("""
import requests

def test_get(httpbin, fixture_session, fixture_function):
requests.get(httpbin.url + "/intest")

def test_post(httpbin, fixture_session):
requests.post(httpbin.url + "/intest")
"""
)
""")

result = pytester.runpytest("--httpdbg", "--httpdbg-dir", str(logs_dir))

Expand All @@ -87,14 +83,12 @@ def test_with_initiator(pytester, tmp_path):
".py", fakepackage="import requests\ndef coucou(url):\n requests.get(url)\n"
)

pytester.makepyfile(
"""
pytester.makepyfile("""
import fakepackage

def test_with_initiator_fake(httpbin):
fakepackage.coucou(httpbin.url)
"""
)
""")

result = pytester.runpytest(
"--httpdbg",
Expand Down Expand Up @@ -125,14 +119,12 @@ def test_without_initiator(pytester, tmp_path):
".py", fakepackage="import requests\ndef coucou(url):\n requests.get(url)\n"
)

pytester.makepyfile(
"""
pytester.makepyfile("""
import fakepackage

def test_without_initiator_fake(httpbin):
fakepackage.coucou(httpbin.url)
"""
)
""")

result = pytester.runpytest("--httpdbg", "--httpdbg-dir", str(logs_dir))

Expand Down