summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/tests.yml12
-rw-r--r--.gitignore1
-rw-r--r--.meta.toml3
-rw-r--r--CHANGES.rst2
-rw-r--r--setup.cfg11
-rw-r--r--setup.py5
-rw-r--r--src/zope/tales/engine.py8
-rw-r--r--src/zope/tales/expressions.py10
-rw-r--r--src/zope/tales/interfaces.py1
-rw-r--r--src/zope/tales/tales.py12
-rw-r--r--src/zope/tales/tests/__init__.py3
-rw-r--r--src/zope/tales/tests/test_expressions.py16
-rw-r--r--src/zope/tales/tests/test_pythonexpr.py8
-rw-r--r--src/zope/tales/tests/test_tales.py10
-rw-r--r--src/zope/tales/tests/test_traverser.py1
-rw-r--r--tox.ini24
16 files changed, 87 insertions, 40 deletions
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 927d9f3..cedf24b 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -17,7 +17,7 @@ jobs:
fail-fast: false
matrix:
os:
- - ubuntu
+ - ["ubuntu", "ubuntu-20.04"]
config:
# [Python version, tox env]
- ["3.9", "lint"]
@@ -28,21 +28,23 @@ jobs:
- ["3.8", "py38"]
- ["3.9", "py39"]
- ["3.10", "py310"]
+ - ["3.11", "py311"]
- ["pypy-2.7", "pypy"]
- ["pypy-3.7", "pypy3"]
- ["3.9", "docs"]
- ["3.9", "coverage"]
- runs-on: ${{ matrix.os }}-latest
+ 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
name: ${{ matrix.config[1] }}
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v3
- name: Set up Python
- uses: actions/setup-python@v2
+ uses: actions/setup-python@v4
with:
python-version: ${{ matrix.config[0] }}
- name: Pip cache
- uses: actions/cache@v2
+ uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.config[0] }}-${{ hashFiles('setup.*', 'tox.ini') }}
diff --git a/.gitignore b/.gitignore
index c724a76..1f321f5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -28,4 +28,5 @@ lib64
log/
parts/
pyvenv.cfg
+testing.log
var/
diff --git a/.meta.toml b/.meta.toml
index fad8c6e..40a5253 100644
--- a/.meta.toml
+++ b/.meta.toml
@@ -2,7 +2,7 @@
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
[meta]
template = "pure-python"
-commit-id = "efb3f62f0f2d8deea657bae8db49a191698e62ef"
+commit-id = "200573eb414d2228d463da3de7d71a6d6335a704"
[python]
with-pypy = true
@@ -11,6 +11,7 @@ with-docs = true
with-sphinx-doctests = false
with-windows = false
with-future-python = false
+with-macos = false
[tox]
use-flake8 = true
diff --git a/CHANGES.rst b/CHANGES.rst
index 9eefd60..7a0595b 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -5,7 +5,7 @@
5.3 (unreleased)
================
-- Nothing changed yet.
+- Add support for Python 3.11.
5.2 (2022-08-24)
diff --git a/setup.cfg b/setup.cfg
index 264b78c..1ecf58c 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -11,3 +11,14 @@ ignore =
.editorconfig
.meta.toml
docs/_build/html/_sources/*
+
+[isort]
+force_single_line = True
+combine_as_imports = True
+sections = FUTURE,STDLIB,THIRDPARTY,ZOPE,FIRSTPARTY,LOCALFOLDER
+known_third_party = six, docutils, pkg_resources
+known_zope =
+known_first_party =
+default_section = ZOPE
+line_length = 79
+lines_after_imports = 2
diff --git a/setup.py b/setup.py
index 2819a54..8b7181e 100644
--- a/setup.py
+++ b/setup.py
@@ -19,7 +19,9 @@
"""Setup for zope.tales package
"""
import os
-from setuptools import setup, find_packages
+
+from setuptools import find_packages
+from setuptools import setup
def read(*rnames):
@@ -61,6 +63,7 @@ setup(
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
+ 'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Natural Language :: English',
diff --git a/src/zope/tales/engine.py b/src/zope/tales/engine.py
index dd07600..41e755f 100644
--- a/src/zope/tales/engine.py
+++ b/src/zope/tales/engine.py
@@ -15,14 +15,14 @@
Each expression engine can have its own expression types and base names.
"""
-from zope.tales.tales import ExpressionEngine
-from zope.tales.expressions import PathExpr
-from zope.tales.expressions import StringExpr
-from zope.tales.expressions import NotExpr
from zope.tales.expressions import DeferExpr
from zope.tales.expressions import LazyExpr
+from zope.tales.expressions import NotExpr
+from zope.tales.expressions import PathExpr
from zope.tales.expressions import SimpleModuleImporter
+from zope.tales.expressions import StringExpr
from zope.tales.pythonexpr import PythonExpr
+from zope.tales.tales import ExpressionEngine
def DefaultEngine():
diff --git a/src/zope/tales/expressions.py b/src/zope/tales/expressions.py
index 18db2b1..41fa7cd 100644
--- a/src/zope/tales/expressions.py
+++ b/src/zope/tales/expressions.py
@@ -28,8 +28,14 @@ import types
import six
from zope.interface import implementer
-from zope.tales.tales import _valid_name, _parse_expr, NAME_RE, Undefined
-from zope.tales.interfaces import ITALESExpression, ITALESFunctionNamespace
+
+from zope.tales.interfaces import ITALESExpression
+from zope.tales.interfaces import ITALESFunctionNamespace
+from zope.tales.tales import NAME_RE
+from zope.tales.tales import Undefined
+from zope.tales.tales import _parse_expr
+from zope.tales.tales import _valid_name
+
Undefs = (Undefined, AttributeError, LookupError, TypeError)
diff --git a/src/zope/tales/interfaces.py b/src/zope/tales/interfaces.py
index 58c234f..6e20d27 100644
--- a/src/zope/tales/interfaces.py
+++ b/src/zope/tales/interfaces.py
@@ -16,6 +16,7 @@ Interface that describes the TALES implementation.
"""
from zope.interface import Interface
+
try:
from zope.tal.interfaces import ITALIterator
except ImportError:
diff --git a/src/zope/tales/tales.py b/src/zope/tales/tales.py
index d5ca006..1766350 100644
--- a/src/zope/tales/tales.py
+++ b/src/zope/tales/tales.py
@@ -17,15 +17,17 @@ An implementation of a TAL expression engine
"""
import re
+
try:
from html import escape
except ImportError: # pragma: PY2
from cgi import escape
-from zope.interface import implementer
-from zope.interface import Interface
import six
+from zope.interface import Interface
+from zope.interface import implementer
+
from zope.tales.interfaces import ITALESIterator
@@ -43,9 +45,9 @@ class ITALExpressionErrorInfo(Interface):
try:
# Override with real, if present
- from zope.tal.interfaces import (ITALExpressionEngine, # noqa: F811
- ITALExpressionCompiler,
- ITALExpressionErrorInfo)
+ from zope.tal.interfaces import ITALExpressionCompiler # noqa: F811
+ from zope.tal.interfaces import ITALExpressionEngine # noqa: F811
+ from zope.tal.interfaces import ITALExpressionErrorInfo # noqa: F811
except ImportError:
pass
diff --git a/src/zope/tales/tests/__init__.py b/src/zope/tales/tests/__init__.py
index b8e0d1d..7b5f922 100644
--- a/src/zope/tales/tests/__init__.py
+++ b/src/zope/tales/tests/__init__.py
@@ -1,6 +1,7 @@
-import six
import unittest
+import six
+
class TestCase(unittest.TestCase):
"""Base test case for Python version compatibility."""
diff --git a/src/zope/tales/tests/test_expressions.py b/src/zope/tales/tests/test_expressions.py
index 9d62875..bfcdc2c 100644
--- a/src/zope/tales/tests/test_expressions.py
+++ b/src/zope/tales/tests/test_expressions.py
@@ -14,14 +14,17 @@
##############################################################################
"""Default TALES expression implementations tests.
"""
-import six
import unittest
+import six
+
+from zope.interface import implementer
+
+import zope.tales.tests
from zope.tales.engine import Engine
from zope.tales.interfaces import ITALESFunctionNamespace
from zope.tales.tales import Undefined
-from zope.interface import implementer
-import zope.tales.tests
+
text_type = str if str is not bytes else unicode # noqa PY2
@@ -341,8 +344,8 @@ class TestParsedExpressions(ExpressionTestBase):
check('string:foo${ab/cd | c/d | e/f/}bar')
def test_defer_expression_returns_wrapper(self):
- from zope.tales.expressions import DeferWrapper
from zope.tales.expressions import DeferExpr
+ from zope.tales.expressions import DeferWrapper
expr = self.engine.compile('defer: B')
self.assertIsInstance(expr, DeferExpr)
self.assertEqual(str(expr), "<DeferExpr 'B'>")
@@ -361,8 +364,8 @@ class TestParsedExpressions(ExpressionTestBase):
self._check_evals_to('deferred', self.context.vars['b'])
def test_lazy_expression_returns_wrapper(self):
- from zope.tales.expressions import LazyWrapper
from zope.tales.expressions import LazyExpr
+ from zope.tales.expressions import LazyWrapper
expr = self.engine.compile('lazy: b')
self.assertIsInstance(expr, LazyExpr)
self.assertEqual(repr(expr), "lazy:'b'")
@@ -393,8 +396,9 @@ class TestParsedExpressions(ExpressionTestBase):
)
def test_builtins_in_path(self):
+ from ..expressions import PathExpr
+ from ..expressions import SubPathExpr
from ..tales import ExpressionEngine
- from ..expressions import PathExpr, SubPathExpr
class MySubPathExpr(SubPathExpr):
ALLOWED_BUILTINS = {'True': True, 'False': False, 'x': None}
diff --git a/src/zope/tales/tests/test_pythonexpr.py b/src/zope/tales/tests/test_pythonexpr.py
index 917c196..c0a3dd7 100644
--- a/src/zope/tales/tests/test_pythonexpr.py
+++ b/src/zope/tales/tests/test_pythonexpr.py
@@ -12,14 +12,14 @@
#
##############################################################################
-import six
import unittest
-from zope.tales.engine import Engine
-from zope.tales.tales import Context
+import six
-from zope.tales.pythonexpr import PythonExpr
+from zope.tales.engine import Engine
from zope.tales.pythonexpr import ExprTypeProxy
+from zope.tales.pythonexpr import PythonExpr
+from zope.tales.tales import Context
class TestPythonExpr(unittest.TestCase):
diff --git a/src/zope/tales/tests/test_tales.py b/src/zope/tales/tests/test_tales.py
index 03a1fe5..eda42a4 100644
--- a/src/zope/tales/tests/test_tales.py
+++ b/src/zope/tales/tests/test_tales.py
@@ -13,16 +13,18 @@
##############################################################################
"""TALES Tests
"""
-from doctest import DocTestSuite
-import unittest
import re
import sys
+import unittest
+from doctest import DocTestSuite
import six
-from zope.tales import tales
-from zope.tales.tests.simpleexpr import SimpleExpr
+
from zope.testing import renormalizing
+
import zope.tales.tests
+from zope.tales import tales
+from zope.tales.tests.simpleexpr import SimpleExpr
class TestIterator(unittest.TestCase):
diff --git a/src/zope/tales/tests/test_traverser.py b/src/zope/tales/tests/test_traverser.py
index dd9eb0d..27b8a8c 100644
--- a/src/zope/tales/tests/test_traverser.py
+++ b/src/zope/tales/tests/test_traverser.py
@@ -14,6 +14,7 @@
""" Tests for zope.tales.expressions.simpleTraverse
"""
from unittest import TestCase
+
from zope.tales.expressions import simpleTraverse
diff --git a/tox.ini b/tox.ini
index 14d1be8..01efdb2 100644
--- a/tox.ini
+++ b/tox.ini
@@ -11,6 +11,7 @@ envlist =
py38
py39
py310
+ py311
pypy
pypy3
docs
@@ -27,15 +28,26 @@ extras =
[testenv:lint]
basepython = python3
skip_install = true
+commands =
+ isort --check-only --diff {toxinidir}/src {toxinidir}/setup.py
+ flake8 src setup.py
+ check-manifest
+ check-python-versions
deps =
- flake8
check-manifest
check-python-versions >= 0.19.1
wheel
+ flake8
+ isort
+
+[testenv:isort-apply]
+basepython = python3
+skip_install = true
+commands_pre =
+deps =
+ isort
commands =
- flake8 src setup.py
- check-manifest
- check-python-versions
+ isort {toxinidir}/src {toxinidir}/setup.py []
[testenv:docs]
basepython = python3
@@ -56,8 +68,8 @@ deps =
commands =
mkdir -p {toxinidir}/parts/htmlcov
coverage run -m zope.testrunner --test-path=src {posargs:-vc}
- coverage html
- coverage report -m --fail-under=99
+ coverage html --ignore-errors
+ coverage report --ignore-errors --show-missing --fail-under=99
[coverage:run]
branch = True