diff --git a/.github/workflows/python-test-versions.yml b/.github/workflows/python-test-versions.yml index 7325fbe7..69f80587 100644 --- a/.github/workflows/python-test-versions.yml +++ b/.github/workflows/python-test-versions.yml @@ -15,7 +15,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.8", "3.9", "3.10"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] poetry-version: ["1.2.2", "1.3.1"] steps: diff --git a/.gitignore b/.gitignore index eecb143a..3e20b9bd 100644 --- a/.gitignore +++ b/.gitignore @@ -212,3 +212,4 @@ pip-selfcheck.json # Custom rules (everything added below won't be overriden by 'Generate .gitignore File' if you use 'Update' option) +docs/source/_build/ diff --git a/poetry.lock b/poetry.lock index 08e02788..062153b7 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,9 +1,10 @@ -# This file is automatically @generated by Poetry 1.6.1 and should not be changed by hand. +# This file is automatically @generated by Poetry and should not be changed by hand. [[package]] name = "aiodns" version = "3.1.1" description = "Simple DNS resolver for asyncio" +category = "main" optional = false python-versions = "*" files = [ @@ -18,6 +19,7 @@ pycares = ">=4.0.0" name = "aiohttp" version = "3.9.1" description = "Async http client/server framework (asyncio)" +category = "main" optional = false python-versions = ">=3.8" files = [ @@ -114,6 +116,7 @@ speedups = ["Brotli", "aiodns", "brotlicffi"] name = "aiosignal" version = "1.3.1" description = "aiosignal: a list of registered asynchronous callbacks" +category = "main" optional = false python-versions = ">=3.7" files = [ @@ -128,6 +131,7 @@ frozenlist = ">=1.1.0" name = "alabaster" version = "0.7.13" description = "A configurable sidebar-enabled Sphinx theme" +category = "dev" optional = false python-versions = ">=3.6" files = [ @@ -139,8 +143,21 @@ files = [ name = "async-timeout" version = "4.0.3" description = "Timeout context manager for asyncio programs" +category = "main" optional = false -python-versions = ">=3.7" +python-versions = ">=3.6" +files = [ + {file = "async-timeout-4.0.2.tar.gz", hash = "sha256:2163e1640ddb52b7a8c80d0a67a08587e5d245cc9c553a74a847056bc2976b15"}, + {file = "async_timeout-4.0.2-py3-none-any.whl", hash = "sha256:8ca1e4fcf50d07413d66d1a5e416e42cfdf5851c981d679a09851a6853383b3c"}, +] + +[[package]] +name = "atomicwrites" +version = "1.4.1" +description = "Atomic file writes." +category = "dev" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" files = [ {file = "async-timeout-4.0.3.tar.gz", hash = "sha256:4640d96be84d82d02ed59ea2b7105a0f7b33abe8703703cd0ab0bf87c427522f"}, {file = "async_timeout-4.0.3-py3-none-any.whl", hash = "sha256:7405140ff1230c310e51dc27b3145b9092d659ce68ff733fb0cefe3ee42be028"}, @@ -150,6 +167,7 @@ files = [ name = "attrs" version = "22.2.0" description = "Classes Without Boilerplate" +category = "main" optional = false python-versions = ">=3.6" files = [ @@ -168,6 +186,7 @@ tests-no-zope = ["cloudpickle", "cloudpickle", "hypothesis", "hypothesis", "mypy name = "cachetools" version = "5.3.2" description = "Extensible memoizing collections and decorators" +category = "main" optional = false python-versions = ">=3.7" files = [ @@ -179,6 +198,7 @@ files = [ name = "cffi" version = "1.16.0" description = "Foreign Function Interface for Python calling C code." +category = "main" optional = false python-versions = ">=3.8" files = [ @@ -243,6 +263,7 @@ pycparser = "*" name = "click" version = "8.1.7" description = "Composable command line interface toolkit" +category = "main" optional = false python-versions = ">=3.7" files = [ @@ -257,6 +278,7 @@ colorama = {version = "*", markers = "platform_system == \"Windows\""} name = "colorama" version = "0.4.6" description = "Cross-platform colored terminal text." +category = "main" optional = false python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" files = [ @@ -268,6 +290,7 @@ files = [ name = "coverage" version = "7.3.2" description = "Code coverage measurement for Python" +category = "dev" optional = false python-versions = ">=3.8" files = [ @@ -349,6 +372,7 @@ test = ["pytest (>=6)"] name = "flake8" version = "5.0.4" description = "the modular source code checker: pep8 pyflakes and co" +category = "dev" optional = false python-versions = ">=3.6.1" files = [ @@ -365,6 +389,7 @@ pyflakes = ">=2.5.0,<2.6.0" name = "frozenlist" version = "1.4.0" description = "A list-like structure which implements collections.abc.MutableSequence" +category = "main" optional = false python-versions = ">=3.8" files = [ @@ -435,6 +460,7 @@ files = [ name = "idna" version = "3.6" description = "Internationalized Domain Names in Applications (IDNA)" +category = "main" optional = false python-versions = ">=3.5" files = [ @@ -444,8 +470,9 @@ files = [ [[package]] name = "iniconfig" -version = "2.0.0" -description = "brain-dead simple config-ini parsing" +version = "1.1.1" +description = "iniconfig: brain-dead simple config-ini parsing" +category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -457,6 +484,7 @@ files = [ name = "isort" version = "5.12.0" description = "A Python utility / library to sort Python imports." +category = "dev" optional = false python-versions = ">=3.8.0" files = [ @@ -474,6 +502,7 @@ requirements-deprecated-finder = ["pip-api", "pipreqs"] name = "maxminddb" version = "2.5.1" description = "Reader for the MaxMind DB format" +category = "main" optional = false python-versions = ">=3.8" files = [ @@ -534,6 +563,7 @@ setuptools = ">=68.2.2" name = "mccabe" version = "0.7.0" description = "McCabe checker, plugin for flake8" +category = "dev" optional = false python-versions = ">=3.6" files = [ @@ -545,6 +575,7 @@ files = [ name = "multidict" version = "6.0.4" description = "multidict implementation" +category = "main" optional = false python-versions = ">=3.7" files = [ @@ -628,6 +659,7 @@ files = [ name = "packaging" version = "23.2" description = "Core utilities for Python packages" +category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -639,6 +671,7 @@ files = [ name = "pluggy" version = "1.3.0" description = "plugin and hook calling mechanisms for python" +category = "dev" optional = false python-versions = ">=3.8" files = [ @@ -650,10 +683,23 @@ files = [ dev = ["pre-commit", "tox"] testing = ["pytest", "pytest-benchmark"] +[[package]] +name = "py" +version = "1.11.0" +description = "library with cross-python path, ini-parsing, io, code, log facilities" +category = "dev" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" +files = [ + {file = "py-1.11.0-py2.py3-none-any.whl", hash = "sha256:607c53218732647dff4acdfcd50cb62615cedf612e72d1724fb1a0cc6405b378"}, + {file = "py-1.11.0.tar.gz", hash = "sha256:51c75c4126074b472f746a24399ad32f6053d1b34b68d2fa41e558e6f4a98719"}, +] + [[package]] name = "pycares" version = "4.4.0" description = "Python interface for c-ares" +category = "main" optional = false python-versions = ">=3.8" files = [ @@ -720,6 +766,7 @@ idna = ["idna (>=2.1)"] name = "pycodestyle" version = "2.9.1" description = "Python style guide checker" +category = "dev" optional = false python-versions = ">=3.6" files = [ @@ -731,6 +778,7 @@ files = [ name = "pycparser" version = "2.21" description = "C parser in Python" +category = "main" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" files = [ @@ -742,6 +790,7 @@ files = [ name = "pyflakes" version = "2.5.0" description = "passive checker of Python programs" +category = "dev" optional = false python-versions = ">=3.6" files = [ @@ -749,10 +798,26 @@ files = [ {file = "pyflakes-2.5.0.tar.gz", hash = "sha256:491feb020dca48ccc562a8c0cbe8df07ee13078df59813b83959cbdada312ea3"}, ] +[[package]] +name = "pyparsing" +version = "3.0.9" +description = "pyparsing module - Classes and methods to define and execute parsing grammars" +category = "dev" +optional = false +python-versions = ">=3.6.8" +files = [ + {file = "pyparsing-3.0.9-py3-none-any.whl", hash = "sha256:5026bae9a10eeaefb61dab2f09052b9f4307d44aee4eda64b309723d8d206bbc"}, + {file = "pyparsing-3.0.9.tar.gz", hash = "sha256:2b020ecf7d21b687f219b71ecad3631f644a47f01403fa1d1036b0c6416d70fb"}, +] + +[package.extras] +diagrams = ["jinja2", "railroad-diagrams"] + [[package]] name = "pytest" version = "7.4.3" description = "pytest: simple powerful testing with Python" +category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -775,6 +840,7 @@ testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "no name = "pytest-asyncio" version = "0.19.0" description = "Pytest support for asyncio" +category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -792,6 +858,7 @@ testing = ["coverage (>=6.2)", "flaky (>=3.5.0)", "hypothesis (>=5.7.1)", "mypy name = "pytest-cov" version = "3.0.0" description = "Pytest plugin for measuring coverage." +category = "dev" optional = false python-versions = ">=3.6" files = [ @@ -810,6 +877,7 @@ testing = ["fields", "hunter", "process-tests", "pytest-xdist", "six", "virtuale name = "pytest-flake8" version = "1.1.1" description = "pytest plugin to check FLAKE8 requirements" +category = "dev" optional = false python-versions = "*" files = [ @@ -825,6 +893,7 @@ pytest = ">=7.0" name = "pytest-isort" version = "3.1.0" description = "py.test plugin to check import ordering using isort" +category = "dev" optional = false python-versions = ">=3.7,<4" files = [ @@ -840,6 +909,7 @@ pytest = ">=5.0" name = "pytest-mock" version = "3.12.0" description = "Thin-wrapper around the mock package for easier use with pytest" +category = "dev" optional = false python-versions = ">=3.8" files = [ @@ -857,6 +927,7 @@ dev = ["pre-commit", "pytest-asyncio", "tox"] name = "pytest-runner" version = "6.0.1" description = "Invoke py.test as distutils command with dependency resolution" +category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -888,6 +959,7 @@ testing-integration = ["build[virtualenv] (>=1.0.3)", "filelock (>=3.4.0)", "jar name = "tomli" version = "2.0.1" description = "A lil' TOML parser" +category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -899,6 +971,7 @@ files = [ name = "yarl" version = "1.9.4" description = "Yet another URL library" +category = "main" optional = false python-versions = ">=3.7" files = [ @@ -1001,4 +1074,4 @@ multidict = ">=4.0" [metadata] lock-version = "2.0" python-versions = "^3.8" -content-hash = "21c9190444e8ce51352c76c3641782ef996ccb001394e4e9b18fcf620c847795" +content-hash = "0a6fe0ec4eb39d277156e47606d0e0d669cd00c17fbce22cc51f7d87c5011f62" diff --git a/pyproject.toml b/pyproject.toml index a67be997..812944ed 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,7 +30,7 @@ classifiers = [ [tool.poetry.dependencies] python = "^3.8" -aiohttp = "^3.9.0" +aiohttp = "3.9.1" aiodns = "^3.0.0" attrs = "^22.1.0" maxminddb = "^2.2.0" diff --git a/tests/test_resolver.py b/tests/test_resolver.py index fdfec144..b14eb218 100644 --- a/tests/test_resolver.py +++ b/tests/test_resolver.py @@ -1,4 +1,5 @@ import socket +from unittest.mock import AsyncMock import pytest @@ -34,15 +35,12 @@ def test_get_ip_info(resolver): @pytest.mark.asyncio async def test_get_real_ext_ip(event_loop, mocker, resolver): async def f(*args, **kwargs): - async def side_effect(*args, **kwargs): - return '127.0.0.1\n' + return '127.0.0.1\n' - resp = mocker.Mock() - resp.text.side_effect = side_effect - return resp + resp = AsyncMock() + resp.text = f - # https://github.com/pytest-dev/pytest-mock#note-about-usage-as-context-manager - mocker.patch('aiohttp.client.ClientSession._request', side_effect=f) + mocker.patch('aiohttp.client.ClientSession._request', return_value=resp) assert await resolver.get_real_ext_ip() == '127.0.0.1'