[Git][debian-gis-team/pytest-recording][master] 4 commits: New upstream version 0.13.1
Antonio Valentino (@antonio.valentino)
gitlab at salsa.debian.org
Thu Dec 14 07:10:47 GMT 2023
Antonio Valentino pushed to branch master at Debian GIS Project / pytest-recording
Commits:
483b8842 by Antonio Valentino at 2023-12-09T11:05:34+00:00
New upstream version 0.13.1
- - - - -
b01f0e19 by Antonio Valentino at 2023-12-09T11:05:34+00:00
Update upstream source from tag 'upstream/0.13.1'
Update to upstream version '0.13.1'
with Debian dir 72f396abe396efbd5316c18f90431281ed167ccd
- - - - -
24d2cd36 by Antonio Valentino at 2023-12-09T11:06:09+00:00
New upstream release
- - - - -
8900c7c7 by Antonio Valentino at 2023-12-09T11:06:46+00:00
Set distribution to unstable
- - - - -
16 changed files:
- .github/workflows/build.yml
- .github/workflows/commit.yml
- .github/workflows/release.yml
- .pre-commit-config.yaml
- CONTRIBUTING.rst
- README.rst
- debian/changelog
- docs/changelog.rst
- pyproject.toml
- src/pytest_recording/_vcr.py
- src/pytest_recording/plugin.py
- tests/test_blocking_network.py
- tests/test_plugin.py
- tests/test_recording.py
- tests/test_replaying.py
- tox.ini
Changes:
=====================================
.github/workflows/build.yml
=====================================
@@ -18,11 +18,11 @@ jobs:
name: Generic pre-commit checks
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout at v3
+ - uses: actions/checkout at v4
with:
fetch-depth: 1
- - uses: actions/setup-python at v4
+ - uses: actions/setup-python at v5
with:
python-version: 3.11
@@ -33,11 +33,11 @@ jobs:
name: Mypy
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout at v3
+ - uses: actions/checkout at v4
with:
fetch-depth: 1
- - uses: actions/setup-python at v4
+ - uses: actions/setup-python at v5
with:
python-version: 3.11
@@ -71,13 +71,16 @@ jobs:
- tox_job: py311
python: "3.11"
os_version: "ubuntu-latest"
+ - tox_job: py312
+ python: "3.12"
+ os_version: "ubuntu-latest"
steps:
- - uses: actions/checkout at v3
+ - uses: actions/checkout at v4
with:
fetch-depth: 1
- - uses: actions/setup-python at v4
+ - uses: actions/setup-python at v5
with:
python-version: ${{ matrix.python }}
=====================================
.github/workflows/commit.yml
=====================================
@@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code
- uses: actions/checkout at v3
+ uses: actions/checkout at v4
with:
fetch-depth: 0
- name: Run commitsar
=====================================
.github/workflows/release.yml
=====================================
@@ -11,7 +11,7 @@ jobs:
steps:
- uses: actions/checkout at master
- name: Set up Python 3.11
- uses: actions/setup-python at v4
+ uses: actions/setup-python at v5
with:
python-version: 3.11
=====================================
.pre-commit-config.yaml
=====================================
@@ -3,7 +3,7 @@ default_language_version:
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
- rev: v4.4.0
+ rev: v4.5.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
@@ -20,12 +20,12 @@ repos:
- id: gitlint
- repo: https://github.com/adrienverge/yamllint
- rev: v1.32.0
+ rev: v1.33.0
hooks:
- id: yamllint
- repo: https://github.com/igorshubovych/markdownlint-cli
- rev: v0.35.0
+ rev: v0.37.0
hooks:
- id: markdownlint
language_version: system
@@ -35,30 +35,19 @@ repos:
hooks:
- id: relint
- - repo: https://github.com/ambv/black
- rev: 23.7.0
- hooks:
- - id: black
- types: [python]
-
- repo: https://github.com/pre-commit/mirrors-mypy
- rev: v1.4.1
+ rev: v1.7.1
hooks:
- id: mypy
exclude: ^(docs/|tests/|setup.py).*$
additional_dependencies: [ "types-pycurl" ]
- - repo: https://github.com/asottile/seed-isort-config
- rev: v2.2.0
- hooks:
- - id: seed-isort-config
-
- - repo: https://github.com/pre-commit/mirrors-isort
- rev: v5.10.1
+ - repo: https://github.com/astral-sh/ruff-pre-commit
+ rev: v0.1.7
hooks:
- - id: isort
+ - id: ruff-format
- repo: https://github.com/astral-sh/ruff-pre-commit
- rev: v0.0.281
+ rev: v0.1.7
hooks:
- id: ruff
=====================================
CONTRIBUTING.rst
=====================================
@@ -47,7 +47,7 @@ Submitting Pull Requests
#. Fork the repository.
#. Enable and install `pre-commit <https://pre-commit.com>`_ to ensure style-guides and code checks are followed.
#. Target the ``master`` branch.
-#. Follow **PEP-8** for naming and `black <https://github.com/psf/black>`_ for formatting.
+#. Follow **PEP-8** for naming and `ruff <https://github.com/astral-sh/ruff>`_ for formatting.
#. Tests are run using ``tox``::
tox -e py37
=====================================
README.rst
=====================================
@@ -226,7 +226,7 @@ Python support
Pytest-recording supports:
-- CPython 3.7, 3.8, 3.9, 3.10 and 3.11
+- CPython 3.7, 3.8, 3.9, 3.10, 3.11, and 3.12
- PyPy 7 (3.6)
License
=====================================
debian/changelog
=====================================
@@ -1,3 +1,9 @@
+pytest-recording (0.13.1-1) unstable; urgency=medium
+
+ * New upstream release.
+
+ -- Antonio Valentino <antonio.valentino at tiscali.it> Sat, 09 Dec 2023 11:06:30 +0000
+
pytest-recording (0.13.0-2) unstable; urgency=medium
* Team upload.
=====================================
docs/changelog.rst
=====================================
@@ -6,6 +6,12 @@ Changelog
`Unreleased`_
-------------
+`0.13.1`_ - 2023-12-07
+----------------------
+
+- Add support for Python 3.12.
+- Add trove classifier for license.
+
`0.13.0`_ - 2023-08-01
----------------------
@@ -192,7 +198,8 @@ Added
- Initial public release
-.. _Unreleased: https://github.com/kiwicom/pytest-recording/compare/v0.13.0...HEAD
+.. _Unreleased: https://github.com/kiwicom/pytest-recording/compare/v0.13.1...HEAD
+.. _0.13.1: https://github.com/kiwicom/pytest-recording/compare/v0.13.0...v0.13.1
.. _0.13.0: https://github.com/kiwicom/pytest-recording/compare/v0.12.2...v0.13.0
.. _0.12.2: https://github.com/kiwicom/pytest-recording/compare/v0.12.1...v0.12.2
.. _0.12.1: https://github.com/kiwicom/pytest-recording/compare/v0.12.0...v0.12.1
=====================================
pyproject.toml
=====================================
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
[project]
name = "pytest-recording"
-version = "0.13.0"
+version = "0.13.1"
description = "A pytest plugin that allows you recording of network interactions via VCR.py"
keywords = ["pytest", "vcr", "network", "mock"]
authors = [{ name = "Dmitry Dygalo", email = "dmitry at dygalo.dev" }]
@@ -16,6 +16,7 @@ classifiers = [
"Development Status :: 4 - Beta",
"Framework :: Pytest",
"Intended Audience :: Developers",
+ "License :: OSI Approved :: MIT License",
"Topic :: Software Development :: Testing",
"Programming Language :: Python",
"Programming Language :: Python :: 3 :: Only",
@@ -27,6 +28,7 @@ classifiers = [
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
+ "Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Operating System :: OS Independent",
@@ -40,7 +42,7 @@ tests = [
"pytest-httpbin",
"pytest-mock",
"requests",
- "Werkzeug==2.3.6"
+ "Werkzeug==3.0.1"
]
dev = ["pytest_recording[tests]"]
@@ -54,19 +56,8 @@ Changelog = "https://github.com/kiwicom/pytest-recording/blob/master/docs/change
[project.entry-points.pytest11]
recording = "pytest_recording.plugin"
-[tool.black]
-line-length = 120
-target_version = ["py37"]
-
-[tool.isort]
-# config compatible with Black
-line_length = 120
-multi_line_output = 3
-default_section = "THIRDPARTY"
-include_trailing_comma = true
-known_third_party = ["_pytest", "packaging", "pytest", "pytest_recording", "vcr", "yaml"]
-
[tool.ruff]
+line-length = 120
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
@@ -76,7 +67,7 @@ select = [
"D", # pydocstyle
]
ignore = [
- "E501", # Line too long, handled by black
+ "E501", # Line too long, handled by ruff
"B008", # Do not perform function calls in argument defaults
"C901", # Too complex
"D100", # Missing docstring in public module
@@ -91,3 +82,10 @@ ignore = [
"D401", # Imperative mood
]
target-version = "py37"
+
+[tool.ruff.format]
+skip-magic-trailing-comma = false
+
+[tool.ruff.isort]
+known-first-party = ["pytest_recording"]
+known-third-party = ["_pytest", "packaging", "pytest", "vcr", "yaml"]
=====================================
src/pytest_recording/_vcr.py
=====================================
@@ -76,7 +76,11 @@ def use_cassette(
except OSError:
pass
record_mode = "new_episodes"
- vcr = VCR(path_transformer=path_transformer, cassette_library_dir=vcr_cassette_dir, record_mode=record_mode)
+ vcr = VCR(
+ path_transformer=path_transformer,
+ cassette_library_dir=vcr_cassette_dir,
+ record_mode=record_mode,
+ )
def extra_path_transformer(path: str) -> str:
"""Paths in extras can be handled as relative and as absolute.
=====================================
src/pytest_recording/plugin.py
=====================================
@@ -25,7 +25,8 @@ def pytest_configure(config: Config) -> None:
config.addinivalue_line("markers", "block_network: Block network access except for VCR recording.")
config.addinivalue_line("markers", "default_cassette: Override the default cassette name.")
config.addinivalue_line(
- "markers", "allowed_hosts: List of regexes to match hosts to where connection must be allowed."
+ "markers",
+ "allowed_hosts: List of regexes to match hosts to where connection must be allowed.",
)
network.install_pycurl_wrapper()
@@ -44,7 +45,10 @@ def pytest_addoption(parser: Parser) -> None:
help='VCR.py record mode. Default to "none".',
)
group.addoption(
- "--block-network", action="store_true", default=False, help="Block network access except for VCR recording."
+ "--block-network",
+ action="store_true",
+ default=False,
+ help="Block network access except for VCR recording.",
)
group.addoption(
"--allowed-hosts",
@@ -148,7 +152,12 @@ def vcr(
config = request.getfixturevalue("vcr_config")
default_cassette = request.getfixturevalue("default_cassette_name")
with use_cassette(
- default_cassette, vcr_cassette_dir, record_mode, vcr_markers, config, pytestconfig
+ default_cassette,
+ vcr_cassette_dir,
+ record_mode,
+ vcr_markers,
+ config,
+ pytestconfig,
) as cassette:
yield cassette
else:
=====================================
tests/test_blocking_network.py
=====================================
@@ -229,8 +229,18 @@ def test_no_vcr_mark_bytearray():
@pytest.mark.parametrize(
"marker, cmd_options, vcr_cfg",
(
- pytest.param('@pytest.mark.block_network(allowed_hosts=["127.0.0.*", "127.0.1.1"])', "", "", id="block_marker"),
- pytest.param("", ("--block-network", "--allowed-hosts=127.0.0.*,127.0.1.1"), "", id="block_cmd"),
+ pytest.param(
+ '@pytest.mark.block_network(allowed_hosts=["127.0.0.*", "127.0.1.1"])',
+ "",
+ "",
+ id="block_marker",
+ ),
+ pytest.param(
+ "",
+ ("--block-network", "--allowed-hosts=127.0.0.*,127.0.1.1"),
+ "",
+ id="block_cmd",
+ ),
pytest.param(
"@pytest.mark.block_network()",
"",
@@ -332,6 +342,7 @@ def test_pycurl(testdir):
# When pycurl is used for network access
testdir.makepyfile(
r"""
+import json
import sys
import pytest
import pycurl
@@ -355,7 +366,7 @@ def test_work(httpbin):
c.setopt(c.WRITEDATA, buffer)
c.perform()
c.close()
- assert buffer.getvalue() == b'{"origin":"127.0.0.1"}\n'
+ assert json.loads(buffer.getvalue()) == {"origin":"127.0.0.1"}
"""
)
@@ -369,6 +380,7 @@ def test_pycurl_with_allowed_hosts(testdir):
# When pycurl is used for network access
testdir.makepyfile(
r"""
+import json
import sys
import pytest
import pycurl
@@ -383,7 +395,7 @@ def test_allowed(httpbin):
c.setopt(c.WRITEDATA, buffer)
c.perform()
c.close()
- assert buffer.getvalue() == b'{"origin":"127.0.0.1"}\n'
+ assert json.loads(buffer.getvalue()) == {"origin":"127.0.0.1"}
@pytest.mark.block_network(allowed_hosts=["127.0.0.*", "127.0.1.1"])
def test_blocked(httpbin):
@@ -482,9 +494,7 @@ import requests
@pytest.mark.block_network({})
def test_request():
requests.get("https://google.com")
- """.format(
- args
- )
+ """.format(args)
)
result = testdir.runpytest()
# Then there should be an error
=====================================
tests/test_plugin.py
=====================================
@@ -4,16 +4,15 @@ from pytest_recording.plugin import RECORD_MODES
@pytest.mark.parametrize(
- "args, expected", [(("--record-mode={}".format(mode),), mode) for mode in RECORD_MODES] + [((), "none")]
+ "args, expected",
+ [(("--record-mode={}".format(mode),), mode) for mode in RECORD_MODES] + [((), "none")],
)
def test_record_mode(testdir, args, expected):
testdir.makepyfile(
"""
def test_mode(record_mode):
assert record_mode == "{}"
- """.format(
- expected
- )
+ """.format(expected)
)
# Record mode depends on the passed CMD arguments
=====================================
tests/test_recording.py
=====================================
@@ -23,9 +23,7 @@ def test_cassette_recording(testdir):
@pytest.mark.vcr
def test_without_network():
pass
- """.format(
- string.ascii_letters
- )
+ """.format(string.ascii_letters)
)
# If recording is enabled
@@ -190,9 +188,7 @@ def test_custom_cassette_name(testdir):
@pytest.mark.vcr("{}")
def test_with_network(httpbin):
assert requests.get(httpbin.url + "/get").status_code == 200
- """.format(
- cassette
- )
+ """.format(cassette)
)
result = testdir.runpytest("--record-mode=all")
@@ -214,9 +210,7 @@ def test_custom_cassette_name_rewrite(testdir):
@pytest.mark.vcr("{}")
def test_with_network(httpbin):
assert requests.get(httpbin.url + "/uuid").status_code == 200
- """.format(
- cassette
- )
+ """.format(cassette)
)
result = testdir.runpytest("--record-mode=rewrite")
@@ -253,9 +247,7 @@ pytestmark = [pytest.mark.vcr("{}")]
def test_network(httpbin):
assert requests.get(httpbin.url + "/ip").status_code == 200
assert requests.get(httpbin.url + "/get").status_code == 200
- """.format(
- ip_response_cassette
- )
+ """.format(ip_response_cassette)
)
result = testdir.runpytest("--record-mode=all")
@@ -309,9 +301,7 @@ def test_network(httpbin):
@pytest.mark.vcr("{}", serializer="json")
def test_custom_name(httpbin):
assert requests.get(httpbin.url + "/ip").status_code == 200
- """.format(
- custom_cassette_path
- )
+ """.format(custom_cassette_path)
)
result = testdir.runpytest("--record-mode=all", "-s")
=====================================
tests/test_replaying.py
=====================================
@@ -38,9 +38,7 @@ def test_combined():
def test_no_vcr(httpbin):
assert requests.get(httpbin.url + "/headers").status_code == 200
-""".format(
- get_response_cassette, ip_response_cassette
- )
+""".format(get_response_cassette, ip_response_cassette)
)
result = testdir.runpytest()
result.assert_outcomes(passed=2)
@@ -65,9 +63,7 @@ def test_single_cassette():
assert requests.get("http://httpbin.org/get").text == '{{"get": true}}'
with pytest.raises(vcr.errors.CannotOverwriteExistingCassetteException):
requests.get("http://httpbin.org/ip")
- """.format(
- get_response_cassette, ip_response_cassette
- )
+ """.format(get_response_cassette, ip_response_cassette)
)
# Then their cassettes are combined
result = testdir.runpytest()
@@ -87,9 +83,7 @@ pytestmark = pytest.mark.vcr()
@pytest.mark.vcr("{}")
def test_combined():
assert requests.get("http://httpbin.org/get").text == '{{"get": true}}'
-""".format(
- get_response_cassette
- )
+""".format(get_response_cassette)
)
# Then it is noop for tests that already have pytest.mark.vcr applied
result = testdir.runpytest()
@@ -124,9 +118,7 @@ def test_custom_path(vcr):
@pytest.mark.vcr(before_record_request=override_before_request)
def test_custom_path_with_kwargs(vcr):
assert vcr._before_record_request("mock") is OVERRIDDEN
- """.format(
- get_response_cassette
- )
+ """.format(get_response_cassette)
)
# Then each test function should have cassettes with merged kwargs
result = testdir.runpytest()
@@ -166,9 +158,7 @@ import requests
def test_custom_path():
assert requests.get("http://httpbin.org/get").text == '{{"get": true}}'
assert requests.get("http://httpbin.org/ip").text == '{{"ip": true}}'
- """.format(
- get_response_cassette, ip_response_cassette
- )
+ """.format(get_response_cassette, ip_response_cassette)
)
# Then they should be combined with each other
result = testdir.runpytest()
@@ -189,9 +179,7 @@ pytestmark = [pytest.mark.vcr(CASSETTE)]
@pytest.mark.vcr(CASSETTE, CASSETTE)
def test_custom_path():
assert requests.get("http://httpbin.org/get").text == '{{"get": true}}'
- """.format(
- get_response_cassette
- )
+ """.format(get_response_cassette)
)
# Then the cassette will be loaded only once
# And will not produce any errors
@@ -218,9 +206,7 @@ class TestSomething:
def test_custom_path(self):
assert requests.get("http://httpbin.org/get").text == '{{"get": true}}'
assert requests.get("http://httpbin.org/ip").text == '{{"ip": true}}'
- """.format(
- get_response_cassette, ip_response_cassette
- )
+ """.format(get_response_cassette, ip_response_cassette)
)
# Then it should be combined with the other marks
result = testdir.runpytest()
@@ -240,9 +226,7 @@ pytestmark = [pytest.mark.vcr("{}")]
def test_own():
assert requests.get("http://httpbin.org/get").text == '{{"get": true}}'
assert requests.get("http://httpbin.org/ip").text == '{{"ip": true}}'
- """.format(
- get_response_cassette
- )
+ """.format(get_response_cassette)
)
create_file("cassettes/test_own_mark/test_own.yaml", ip_cassette)
# Then it should use a cassette with a default name
@@ -270,9 +254,7 @@ def before_request(request):
@pytest.mark.vcr
def test_own(vcr):
assert vcr._before_record_request("mock") is EXPECTED
- """.format(
- scope
- )
+ """.format(scope)
)
# Then its config values should be merged with test-specific ones
result = testdir.runpytest("-s")
@@ -329,7 +311,8 @@ def test_feature():
@pytest.mark.skipif(
- VCR_VERSION >= (4, 4, 0), reason="Newer VCRpy versions do not use the `assert` statement in matchers"
+ VCR_VERSION >= (4, 4, 0),
+ reason="Newer VCRpy versions do not use the `assert` statement in matchers",
)
def test_assertions_rewrite(testdir, create_file, get_cassette):
# When a response match is not found
@@ -363,9 +346,7 @@ import requests
def test_feature():
assert requests.get("http://httpbin.org/get").text == '{{"get": true}}'
assert requests.get("http://httpbin.org/ip").text == '{{"ip": true}}'
- """.format(
- get_response_cassette
- )
+ """.format(get_response_cassette)
)
# Then the default cassette should always be used together with the extra one
create_file("cassettes/test_default_cassette_always_exist/test_feature.yaml", ip_cassette)
=====================================
tox.ini
=====================================
@@ -1,5 +1,5 @@
[tox]
-envlist = py{37,38,39,310,311,py3},no_pycurl,vcr_431,coverage-report
+envlist = py{37,38,39,310,311,312,py3},no_pycurl,vcr_431,coverage-report
[testenv]
setenv =
@@ -47,7 +47,7 @@ description = Report coverage over all measured test runs.
basepython = python3.8
deps = coverage
skip_install = true
-depends = {py37,py38,py39,py310,py311,pypy3}
+depends = {py37,py38,py39,py310,py311,py312,pypy3}
commands =
coverage combine
coverage report
View it on GitLab: https://salsa.debian.org/debian-gis-team/pytest-recording/-/compare/142b4af68e5b4b224b5dfa707f36aec9e0c25bab...8900c7c78b12be68f196058dcf61c8b7c3eb4d01
--
View it on GitLab: https://salsa.debian.org/debian-gis-team/pytest-recording/-/compare/142b4af68e5b4b224b5dfa707f36aec9e0c25bab...8900c7c78b12be68f196058dcf61c8b7c3eb4d01
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20231214/ad64e96c/attachment-0001.htm>
More information about the Pkg-grass-devel
mailing list