Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update supported Python versions #50

Merged
merged 5 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
name: pre-commit

on:
pull_request:
push:
branches:
- master
# Allow to run this workflow manually from the Actions tab
workflow_dispatch:

env:
FORCE_COLOR: 1

jobs:
pre-commit:
name: linting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
- uses: pre-commit/action@v3.0.1
with:
extra_args: --all-files --show-diff-on-failure
env:
PRE_COMMIT_COLOR: always
- uses: pre-commit-ci/lite-action@v1.1.0
if: always()
with:
msg: Apply pre-commit code formatting
23 changes: 13 additions & 10 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,15 @@ jobs:
- ["ubuntu", "ubuntu-latest"]
config:
# [Python version, tox env]
- ["3.9", "release-check"]
- ["3.9", "lint"]
- ["3.7", "py37"]
- ["3.8", "py38"]
- ["3.9", "py39"]
- ["3.10", "py310"]
- ["3.11", "py311"]
- ["3.12", "py312"]
- ["3.11", "release-check"]
- ["3.9", "py39"]
- ["3.10", "py310"]
- ["3.11", "py311"]
- ["3.12", "py312"]
- ["3.13", "py313"]
- ["pypy-3.10", "pypy3"]
- ["3.9", "docs"]
- ["3.9", "coverage"]
- ["3.11", "docs"]
- ["3.11", "coverage"]

runs-on: ${{ matrix.os[1] }}
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
Expand All @@ -41,6 +39,7 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.config[0] }}
allow-prereleases: true
- name: Pip cache
uses: actions/cache@v4
with:
Expand All @@ -54,7 +53,11 @@ jobs:
python -m pip install --upgrade pip
pip install tox
- name: Test
if: ${{ !startsWith(runner.os, 'Mac') }}
run: tox -e ${{ matrix.config[1] }}
- name: Test (macOS)
if: ${{ startsWith(runner.os, 'Mac') }}
run: tox -e ${{ matrix.config[1] }}-universal2
- name: Coverage
if: matrix.config[1] == 'coverage'
run: |
Expand Down
2 changes: 1 addition & 1 deletion .meta.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
[meta]
template = "pure-python"
commit-id = "7713fd86"
commit-id = "886d86ee"

[python]
with-sphinx-doctests = false
Expand Down
72 changes: 27 additions & 45 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,46 +1,28 @@
---
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
minimum_pre_commit_version: '3.6'
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: fix-encoding-pragma
args: [--remove]
- id: check-yaml
- id: debug-statements
language_version: python3
- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
hooks:
- id: flake8
language_version: python3
additional_dependencies: [flake8-typing-imports==1.14.0]
args: ["--per-file-ignores=src/zope/pytestlayer/tests/test_integration.py:E501"]
- repo: https://github.com/hhatto/autopep8
rev: v2.0.4
hooks:
- id: autopep8
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort
args: [--filter-files]
files: \.py$
- repo: local
hooks:
- id: rst
name: rst
entry: rst-lint --encoding utf-8
exclude: ./doc/*
# We have Sphinx directives in the docs. This cannot be validated
# here. We therefore include two rst-linter. They complement each
# other. This regex matches all *.rst not in the doc/ folder.
files: ^[^(doc)].*rst
language: python
additional_dependencies: [pygments, restructuredtext_lint]
- repo: https://github.com/rstcheck/rstcheck
rev: 'v6.2.0'
hooks:
- id: rstcheck
args: ["--ignore-messages", 'No directive entry for "autosummary"|No role entry for "ref"|Unknown interpreted text role "ref"|Unknown directive type "(autosummary|literalinclude|toctree)"']
- repo: https://github.com/pycqa/isort
rev: "5.13.2"
hooks:
- id: isort
- repo: https://github.com/hhatto/autopep8
rev: "v2.3.1"
hooks:
- id: autopep8
args: [--in-place, --aggressive, --aggressive]
- repo: https://github.com/asottile/pyupgrade
rev: v3.19.0
hooks:
- id: pyupgrade
args: [--py39-plus]
- repo: https://github.com/isidentical/teyit
rev: 0.4.3
hooks:
- id: teyit
- repo: https://github.com/PyCQA/flake8
rev: "7.1.1"
hooks:
- id: flake8
additional_dependencies:
- flake8-debugger == 4.1.2
4 changes: 3 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ Change log for zope.pytestlayer
8.3 (unreleased)
================

- Nothing changed yet.
- Add support for Python 3.13.

- Drop support for Python 3.7, 3.8.


8.2 (2024-05-15)
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ include *.rst
include *.txt
include buildout.cfg
include tox.ini
include .pre-commit-config.yaml

recursive-include docs *.py
recursive-include docs *.rst
Expand Down
21 changes: 21 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/pure-python

[build-system]
requires = ["setuptools <= 75.6.0"]
build-backend = "setuptools.build_meta"

[tool.coverage.run]
branch = true
source = ["zope.pytestlayer"]

[tool.coverage.report]
fail_under = 98
precision = 2
ignore_errors = true
show_missing = true
exclude_lines = ["pragma: no cover", "pragma: nocover", "except ImportError:", "raise NotImplementedError", "if __name__ == '__main__':", "self.fail", "raise AssertionError", "raise unittest.Skip"]

[tool.coverage.html]
directory = "parts/htmlcov"
5 changes: 2 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
name='zope.pytestlayer',
version='8.3.dev0',

python_requires='>=3.7',
python_requires='>=3.9',
install_requires=[
'pytest >= 6, < 8',
'setuptools',
Expand Down Expand Up @@ -49,12 +49,11 @@
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"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",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
Expand Down
6 changes: 3 additions & 3 deletions src/zope/pytestlayer/fixture.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import zope.dottedname.resolve


class ZopeLayerState(object):
class ZopeLayerState:

def __init__(self):
self.current = set()
Expand Down Expand Up @@ -104,7 +104,7 @@ def get_layer_name(layer):
# As per zope.testrunner conventions, a layer is assumed to have a
# __name__ even if it's not a class.
name = layer.__name__
return '%s.%s' % (layer.__module__, name)
return f'{layer.__module__}.{name}'


def make_identifier(string):
Expand All @@ -115,7 +115,7 @@ def make_identifier(string):
def get_fixture_name(layer, scope):
name = make_identifier(get_layer_name(layer))
layerid = id(layer)
return 'zope_layer_{scope}_{name}_{layerid}'.format(**locals())
return f'zope_layer_{scope}_{name}_{layerid}'


LAYERS = {}
Expand Down
7 changes: 3 additions & 4 deletions src/zope/pytestlayer/layered.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class LayeredTestCaseFunction(_pytest.unittest.TestCaseFunction):
def from_parent(cls, parent, name, **kw):
description = get_description(parent)
keywords = get_keywords(description)
function = super(LayeredTestCaseFunction, cls).from_parent(
function = super().from_parent(
parent=parent,
name=name,
keywords=keywords,
Expand All @@ -66,7 +66,7 @@ def setup(self):

def teardown(self):
_testcase = self._testcase
super(LayeredTestCaseFunction, self).teardown()
super().teardown()
# Do not die with a meaningless error message when rerunning doctests:
self._testcase = _testcase

Expand Down Expand Up @@ -96,5 +96,4 @@ def walk_suite(suite):
fixture.raise_if_bad_layer(suite.layer)
yield item, suite.layer
else:
for result in walk_suite(item):
yield result
yield from walk_suite(item)
2 changes: 1 addition & 1 deletion src/zope/pytestlayer/tests/fixture/bad_layer/test_core.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import unittest


class FooLayer(object):
class FooLayer:
__name__ = 'FooLayer'


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from zope.pytestlayer.testing import log_to_terminal


class FooLayer(object):
class FooLayer:

@classmethod
def setUp(cls):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from zope.pytestlayer.testing import log_to_terminal


class FooLayer(object):
class FooLayer:

@classmethod
def setUp(cls):
Expand All @@ -24,7 +24,7 @@ def testTearDown(cls):
del cls.test_foo


class BarLayer(object):
class BarLayer:

@classmethod
def setUp(cls):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import unittest


class Layer(object):
class Layer:

def __init__(self, value, bases=()):
self.__name__ = 'TestLayer'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import unittest


class FooLayer(object):
class FooLayer:
pass


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from zope.pytestlayer.testing import log_to_terminal


class FooLayer(object):
class FooLayer:

@classmethod
def setUp(cls):
Expand All @@ -24,7 +24,7 @@ def testTearDown(cls):
del cls.test_foo


class BarLayer(object):
class BarLayer:

@classmethod
def setUp(cls):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from zope.pytestlayer.testing import log_to_terminal


class FooLayer(object):
class FooLayer:

@classmethod
def setUp(cls):
Expand All @@ -27,7 +27,7 @@ def testTearDown(cls):
del cls.test_foo


class BarLayer(object):
class BarLayer:

@classmethod
def setUp(cls):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from zope.pytestlayer.testing import log_to_terminal


class FooLayer(object):
class FooLayer:

@classmethod
def setUp(cls):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from zope.pytestlayer.testing import log_to_terminal


class FooLayer(object):
class FooLayer:

@classmethod
def setUp(cls):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from zope.pytestlayer.testing import log_to_terminal


class FooLayer(object):
class FooLayer:

@classmethod
def setUp(cls):
Expand Down
Loading
Loading