From 45481f87536f4fe33e26b35615d0044b3829dcd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Sun, 13 Oct 2024 15:38:58 -0700 Subject: [PATCH 1/4] MAINT: removing python3.7 support --- .github/workflows/python-tests.yml | 18 +++--------------- CHANGES.rst | 2 +- setup.cfg | 7 +++---- tox.ini | 3 +-- 4 files changed, 8 insertions(+), 22 deletions(-) diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index ca39d8c..5c90c22 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -17,24 +17,12 @@ jobs: fail-fast: false matrix: include: - - os: macos-12 - python-version: 3.7 - toxenv: py37-test-pytestoldest - os: ubuntu-latest - python-version: 3.7 - toxenv: py37-test-pytest50 - - os: ubuntu-latest - python-version: 3.7 - toxenv: py37-test-pytest51 - - os: windows-latest - python-version: 3.7 - toxenv: py37-test-pytest52 - - os: windows-latest python-version: 3.8 - toxenv: py38-test-pytest53 - - os: ubuntu-latest + toxenv: py38-test-pytestoldest + - os: windows-latest python-version: 3.8 - toxenv: py38-test-pytest60 + toxenv: py38-test-60 - os: ubuntu-latest python-version: 3.9 toxenv: py39-test-pytest61 diff --git a/CHANGES.rst b/CHANGES.rst index e22a20e..b7f4a56 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,7 +1,7 @@ 0.4.2 (unreleased) ================== -- No changes yet. +- Versions of Python <3.8 are no longer supported. [#81] 0.4.1 (2023-09-25) diff --git a/setup.cfg b/setup.cfg index f84b2fe..457dacf 100644 --- a/setup.cfg +++ b/setup.cfg @@ -12,7 +12,6 @@ classifiers = Programming Language :: Python Programming Language :: Python :: 3 Programming Language :: Python :: 3 :: Only - Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 @@ -30,11 +29,11 @@ keywords = remote, data, pytest, py.test [options] zip_safe = False packages = find: -python_requires = >=3.7 +python_requires = >=3.8 setup_requires = setuptools_scm install_requires = - pytest>=4.6 + pytest>=5.0 packaging [options.entry_points] @@ -46,7 +45,7 @@ exclude = tests [tool:pytest] -minversion = 4.6 +minversion = 5.0 testpaths = tests remote_data_strict = true filterwarnings = error diff --git a/tox.ini b/tox.ini index 2d50beb..8565aad 100644 --- a/tox.ini +++ b/tox.ini @@ -11,8 +11,7 @@ isolated_build = true changedir = .tmp/{envname} description = run tests deps = - pytestoldest: pytest==4.6.* - pytest50: pytest==5.0.* + pytestoldest: pytest==5.0.0 pytest51: pytest==5.1.* pytest52: pytest==5.2.* pytest53: pytest==5.3.* From cbd7f3cee8a4a3c697d274e79e65df91c2eac7df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Sun, 13 Oct 2024 15:40:42 -0700 Subject: [PATCH 2/4] MAINT: running pyupgrade --- pytest_remotedata/disable_internet.py | 14 +++++++------- tests/__init__.py | 2 -- tests/test_socketblocker.py | 8 ++++---- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/pytest_remotedata/disable_internet.py b/pytest_remotedata/disable_internet.py index a6ec6fe..54a850a 100644 --- a/pytest_remotedata/disable_internet.py +++ b/pytest_remotedata/disable_internet.py @@ -29,9 +29,9 @@ def _resolve_host_ips(hostname, port=80): IPv4/v6 dual stack. """ try: - ips = set([s[-1][0] for s in socket.getaddrinfo(hostname, port)]) + ips = {s[-1][0] for s in socket.getaddrinfo(hostname, port)} except socket.gaierror: - ips = set([]) + ips = set() ips.add(hostname) return ips @@ -59,7 +59,7 @@ def new_function(*args, **kwargs): return original_function(*args, **kwargs) host = args[1][0] addr_arg = 1 - valid_hosts = set(['localhost', '127.0.0.1', '::1']) + valid_hosts = {'localhost', '127.0.0.1', '::1'} else: # The only other function this is used to wrap currently is # socket.create_connection, which should be passed a 2-tuple, but @@ -69,7 +69,7 @@ def new_function(*args, **kwargs): host = args[0][0] addr_arg = 0 - valid_hosts = set(['localhost', '127.0.0.1']) + valid_hosts = {'localhost', '127.0.0.1'} # Astropy + GitHub data if allow_astropy_data: @@ -86,7 +86,7 @@ def new_function(*args, **kwargs): if host in (hostname, fqdn): host = 'localhost' - host_ips = set([host]) + host_ips = {host} new_addr = (host, args[addr_arg][1]) args = args[:addr_arg] + (new_addr,) + args[addr_arg + 1:] else: @@ -95,9 +95,9 @@ def new_function(*args, **kwargs): if len(host_ips & valid_hosts) > 0: # Any overlap is acceptable return original_function(*args, **kwargs) else: - raise IOError("An attempt was made to connect to the internet " + raise OSError("An attempt was made to connect to the internet " "by a test that was not marked `remote_data`. The " - "requested host was: {0}".format(host)) + "requested host was: {}".format(host)) return new_function diff --git a/tests/__init__.py b/tests/__init__.py index 800d82e..e69de29 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,2 +0,0 @@ -from __future__ import (absolute_import, division, print_function, - unicode_literals) diff --git a/tests/test_socketblocker.py b/tests/test_socketblocker.py index 574a9cf..0c082cc 100644 --- a/tests/test_socketblocker.py +++ b/tests/test_socketblocker.py @@ -14,14 +14,14 @@ def test_outgoing_fails(): urlopen('http://www.python.org') -class StoppableHTTPServer(HTTPServer, object): +class StoppableHTTPServer(HTTPServer): def __init__(self, *args): - super(StoppableHTTPServer, self).__init__(*args) + super().__init__(*args) self.stop = False def handle_request(self): self.stop = True - super(StoppableHTTPServer, self).handle_request() + super().handle_request() def serve_forever(self): """ @@ -50,7 +50,7 @@ def test_localconnect_succeeds(localhost): server.start() time.sleep(0.1) - urlopen('http://{localhost:s}:{port:d}'.format(localhost=localhost, port=port)).close() + urlopen(f'http://{localhost:s}:{port:d}').close() httpd.server_close() From 40945fb0ad0d645752fba02bab34a22d52e0971f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Sun, 13 Oct 2024 15:43:39 -0700 Subject: [PATCH 3/4] MAINT: adding python 3.13 --- .github/workflows/python-tests.yml | 13 ++++++++----- setup.cfg | 1 + tox.ini | 3 ++- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index 5c90c22..39276f0 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -44,15 +44,18 @@ jobs: - os: ubuntu-latest python-version: '3.12' toxenv: py312-test-pytest82 - - os: macos-latest + - os: ubuntu-latest + python-version: '3.13' + toxenv: py313-test-pytest83 + - os: macos-latest python-version: '3.12' toxenv: py312-test-pytestdev - os: windows-latest - python-version: '3.12' - toxenv: py312-test-pytestdev + python-version: '3.13' + toxenv: py313-test-pytestdev - os: ubuntu-latest - python-version: '3.12' - toxenv: py312-test-pytestdev + python-version: '3.13' + toxenv: py313-test-pytestdev steps: - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 diff --git a/setup.cfg b/setup.cfg index 457dacf..3ef381c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -17,6 +17,7 @@ classifiers = Programming Language :: Python :: 3.10 Programming Language :: Python :: 3.11 Programming Language :: Python :: 3.12 + Programming Language :: Python :: 3.13 Programming Language :: Python :: Implementation :: CPython Topic :: Software Development :: Testing Topic :: Utilities diff --git a/tox.ini b/tox.ini index 8565aad..b06be6c 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] envlist = - py{37,38,39,310,311,312}-test{,-devdeps} + py{38,39,310,311,312,313}-test{,-devdeps} codestyle requires = setuptools >= 30.3.0 @@ -23,6 +23,7 @@ deps = pytest74: pytest==7.4.* pytest81: pytest==8.1.* pytest82: pytest==8.2.* + pytest83: pytest==8.3.* pytestdev: git+https://github.com/pytest-dev/pytest#egg=pytest commands = From c44f76c6331f3287e82712ea6dff64fd55dc947c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Sun, 13 Oct 2024 15:49:20 -0700 Subject: [PATCH 4/4] MAINT: fix syntax --- .github/workflows/python-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index 39276f0..880b174 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -47,7 +47,7 @@ jobs: - os: ubuntu-latest python-version: '3.13' toxenv: py313-test-pytest83 - - os: macos-latest + - os: macos-latest python-version: '3.12' toxenv: py312-test-pytestdev - os: windows-latest