Skip to content

Commit

Permalink
Merge pull request #81 from bsipocz/MAINT_remove_py37
Browse files Browse the repository at this point in the history
MAINT: cleanup python37 and add new versions
  • Loading branch information
pllim authored Oct 14, 2024
2 parents d046350 + c44f76c commit 3ca74d9
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 40 deletions.
29 changes: 10 additions & 19 deletions .github/workflows/python-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -56,15 +44,18 @@ jobs:
- os: ubuntu-latest
python-version: '3.12'
toxenv: py312-test-pytest82
- 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
Expand Down
2 changes: 1 addition & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
14 changes: 7 additions & 7 deletions pytest_remotedata/disable_internet.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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


Expand Down
8 changes: 4 additions & 4 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ 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
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
Expand All @@ -30,11 +30,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]
Expand All @@ -46,7 +46,7 @@ exclude =
tests

[tool:pytest]
minversion = 4.6
minversion = 5.0
testpaths = tests
remote_data_strict = true
filterwarnings = error
2 changes: 0 additions & 2 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +0,0 @@
from __future__ import (absolute_import, division, print_function,
unicode_literals)
8 changes: 4 additions & 4 deletions tests/test_socketblocker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand Down Expand Up @@ -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()


Expand Down
6 changes: 3 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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.*
Expand All @@ -24,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 =
Expand Down

0 comments on commit 3ca74d9

Please sign in to comment.