Skip to content

Commit 75ff85b

Browse files
authored
Add support for Python 3.12 and 3.13. (#29)
Drop support for Python 3.7 and 3.8.
1 parent 6e7d527 commit 75ff85b

File tree

9 files changed

+47
-46
lines changed

9 files changed

+47
-46
lines changed

.coveragerc

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ source = gocept.testing
44

55
[report]
66
precision = 2
7-
# PY2 should be updated to 100 when Python 3 only.
8-
fail_under = 98
7+
fail_under = 100
98

109
[html]
1110
directory = coverage-report

.github/workflows/tests.yml

+8-10
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@ name: tests
22

33
on:
44
push:
5-
branches: [ main ]
65
pull_request:
7-
branches: [ main ]
8-
type: [ "opened", "reopened", "synchronize" ]
96
schedule:
107
- cron: '0 12 * * 0' # run once a week on Sunday
118
# Allow to run this workflow manually from the Actions tab
@@ -17,23 +14,24 @@ jobs:
1714
matrix:
1815
config:
1916
# [Python version, tox env]
20-
- ["3.7", "py37"]
21-
- ["3.8", "py38"]
2217
- ["3.9", "py39"]
2318
- ["3.10", "py310"]
2419
- ["3.11", "py311"]
25-
- ["pypy-3.7", "pypy3"]
26-
- ["3.9", "coverage"]
20+
- ["3.12", "py312"]
21+
- ["3.13", "py313"]
22+
- ["pypy-3.10", "pypy3"]
23+
- ["3.11", "coverage"]
2724
runs-on: ubuntu-latest
2825
name: ${{ matrix.config[1] }}
2926
steps:
30-
- uses: actions/checkout@v2
27+
- uses: actions/checkout@v4
3128
- name: Set up Python
32-
uses: actions/setup-python@v2
29+
uses: actions/setup-python@v5
3330
with:
3431
python-version: ${{ matrix.config[0] }}
32+
allow-prereleases: true
3533
- name: Pip cache
36-
uses: actions/cache@v2
34+
uses: actions/cache@v4
3735
with:
3836
path: ~/.cache/pip
3937
key: ${{ runner.os }}-pip-${{ hashFiles('setup.*', 'tox.ini') }}

.pre-commit-config.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
repos:
33
- repo: https://github.com/pre-commit/pre-commit-hooks
4-
rev: v4.5.0
4+
rev: v4.6.0
55
hooks:
66
- id: trailing-whitespace
77
- id: end-of-file-fixer
@@ -13,17 +13,17 @@ repos:
1313
- id: debug-statements
1414
language_version: python3
1515
- repo: https://github.com/PyCQA/flake8
16-
rev: 6.1.0
16+
rev: 7.0.0
1717
hooks:
1818
- id: flake8
1919
language_version: python3
2020
args: ["--doctests"]
2121
- repo: https://github.com/hhatto/autopep8
22-
rev: v2.0.4
22+
rev: v2.1.0
2323
hooks:
2424
- id: autopep8
2525
- repo: https://github.com/PyCQA/isort
26-
rev: 5.12.0
26+
rev: 5.13.2
2727
hooks:
2828
- id: isort
2929
args: [--filter-files]

CHANGES.rst

+10-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,15 @@ Changelog
44
3.1 (unreleased)
55
----------------
66

7-
- Add support for Python 3.11.
7+
Backwards incompatible changes
8+
++++++++++++++++++++++++++++++
9+
10+
- Drop support for Python 3.7, 3.8.
11+
12+
Features
13+
++++++++
14+
15+
- Add support for Python 3.11, 3.12 and 3.13 (as of beta 1).
816

917

1018
3.0 (2021-08-26)
@@ -20,7 +28,7 @@ Backwards incompatible changes
2028
Features
2129
++++++++
2230

23-
- Add support for Python 3.8, 3.9 and 3.10 (as of rc.1).
31+
- Add support for Python 3.8, 3.9 and 3.10 (as of rc.1).
2432

2533

2634
2.0.post1 (2018-11-22)

LICENSE.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
Copyright (c) 2011-2021 gocept gmbh & co. kg
2+
Copyright (c) 2024 Minddistrict
23
Permission is hereby granted, free of charge, to any person obtaining a copy of this
34
software and associated documentation files (the "Software"), to deal in the Software
45
without restriction, including without limitation the rights to use, copy, modify, merge,

README.rst

+7-7
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
gocept.testing
33
==============
44

5-
.. image:: https://github.com/gocept/gocept.testing/workflows/tests/badge.svg
6-
:target: https://github.com/gocept/gocept.testing/actions?query=workflow%3Atests
5+
.. image:: https://github.com/minddistrict/gocept.testing/workflows/tests/badge.svg
6+
:target: https://github.com/minddistrict/gocept.testing/actions?query=workflow%3Atests
77

8-
.. image:: https://coveralls.io/repos/github/gocept/gocept.testing/badge.svg
9-
:target: https://coveralls.io/github/gocept/gocept.testing
8+
.. image:: https://coveralls.io/repos/github/minddistrict/gocept.testing/badge.svg
9+
:target: https://coveralls.io/github/minddistrict/gocept.testing
1010

1111

1212
This package collects various helpers for writing tests.
@@ -18,7 +18,7 @@ assertEllipsis
1818
==============
1919

2020
An assertion which is very helpful when using Testbrowser with
21-
unittest.TestCase (instead of doctests).
21+
``unittest.TestCase`` (instead of ``doctest``).
2222

2323
Some examples::
2424

@@ -75,7 +75,7 @@ mock patch context
7575

7676
``gocept.testing.mock.Patches`` collects `mock`_ patches that are valid for the
7777
whole TestCase, and resets them all in one go in tearDown (this is pending
78-
incluion upstream as ``mock.patcher()``, see `issue 30`_)::
78+
inclusion upstream as ``mock.patcher()``, see `issue 30`_)::
7979

8080
class MyTest(unittest.TestCase):
8181

@@ -98,7 +98,7 @@ Note that ``gocept.testing`` does not declare a dependency on ``mock`` to be as
9898
lightweight as possible, so clients need to do that themselves.
9999

100100
If you want to save typing, you can mix ``gocept.testing.mock.PatchHelper``
101-
into your TestCase, it defines a setUp method that instatiates ``Patches`` and
101+
into your TestCase, it defines a setUp method that instantiates ``Patches`` and
102102
a tearDown that calls ``reset()`` on it.
103103

104104

setup.py

+8-10
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
setup(
66
name='gocept.testing',
77
version='3.1.dev0',
8-
author='gocept <mail at gocept dot com>',
9-
author_email='mail@gocept.com',
10-
url='https://github.com/gocept/gocept.testing',
8+
author='minddistrict <mail at minddistrict dot com>',
9+
author_email='mail@minddistrict.com',
10+
url='https://github.com/minddistrict/gocept.testing',
1111
description="""\
1212
A collection of test helpers, additional assertions, and the like.""",
1313
classifiers=[
@@ -19,11 +19,11 @@
1919
'Operating System :: OS Independent',
2020
'Programming Language :: Python',
2121
'Programming Language :: Python :: 3',
22-
'Programming Language :: Python :: 3.7',
23-
'Programming Language :: Python :: 3.8',
2422
'Programming Language :: Python :: 3.9',
2523
'Programming Language :: Python :: 3.10',
2624
'Programming Language :: Python :: 3.11',
25+
'Programming Language :: Python :: 3.12',
26+
'Programming Language :: Python :: 3.13',
2727
'Programming Language :: Python :: Implementation',
2828
'Programming Language :: Python :: Implementation :: CPython',
2929
'Programming Language :: Python :: Implementation :: PyPy',
@@ -33,18 +33,16 @@
3333
'Topic :: Software Development :: Libraries :: Python Modules',
3434
'Topic :: Software Development :: Testing',
3535
],
36-
long_description=(
37-
open('README.rst').read()
38-
+ '\n\n'
39-
+ open('CHANGES.rst').read()),
36+
long_description=(open('README.rst').read() + '\n\n' +
37+
open('CHANGES.rst').read()),
4038
packages=find_packages('src'),
4139
package_dir={'': 'src'},
4240
include_package_data=True,
4341
zip_safe=False,
4442
license='MIT',
4543
keywords="testing unittest assertions",
4644
namespace_packages=['gocept'],
47-
python_requires='>=3.7',
45+
python_requires='>=3.9',
4846
install_requires=[
4947
'setuptools',
5048
],

src/gocept/testing/assertion.py

+6-8
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,23 @@ def ellipsis_match(expected, actual):
2222
class Ellipsis:
2323
"""Assertion helper that provides doctest-style ellipsis matching.
2424
25-
Inherit from this class in additition to unittest.TestCase.
25+
Inherit from this class in addition to unittest.TestCase.
2626
"""
2727

2828
def assertEllipsis(self, expected, actual):
2929
if ellipsis_match(expected, actual):
3030
return True
3131
# report ndiff
3232
engine = difflib.Differ(charjunk=difflib.IS_CHARACTER_JUNK)
33-
diff = list(engine.compare(expected.splitlines(True),
34-
actual.splitlines(True)))
33+
diff = list(
34+
engine.compare(expected.splitlines(True), actual.splitlines(True)))
3535
kind = 'ndiff with -expected +actual'
3636
diff = [line.rstrip() + '\n' for line in diff]
3737
self.fail('Differences (%s):\n' % kind + ''.join(diff))
3838

3939
def assertNotEllipsis(self, expected, actual):
4040
if ellipsis_match(expected, actual):
41-
self.fail(
42-
'Value unexpectedly matches expression %r.' % expected)
41+
self.fail('Value unexpectedly matches expression %r.' % expected)
4342

4443

4544
class Exceptions:
@@ -64,9 +63,8 @@ def __exit__(self, exc_type, exc_value, tb):
6463
if exc_type is None:
6564
return True
6665
exc_name = exc_type.__name__
67-
message = (
68-
'Unexpectedly raised %s, original traceback follows:\n'
69-
% exc_name)
66+
message = ('Unexpectedly raised %s, original traceback follows:\n' %
67+
exc_name)
7068
# cut off "Traceback: (most recent call last)" and the original
7169
# message, since we're printing that ourselves
7270
stack = ''.join(

tox.ini

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
[tox]
22
envlist =
3-
py37,
4-
py38,
53
py39,
64
py310,
75
py311,
6+
py312,
7+
py313,
88
pypy3,
99
coverage,
1010
minversion = 1.6
@@ -21,6 +21,5 @@ deps =
2121
{[testenv]deps}
2222
pytest-cov
2323
coverage
24-
coverage-python-version
2524
commands =
2625
py.test --cov=src --cov-report=html []

0 commit comments

Comments
 (0)