Skip to content
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
36 changes: 36 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/zope-product
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:
permissions:
contents: read
pull-requests: write
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@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd #v3.0.1
with:
extra_args: --all-files --show-diff-on-failure
env:
PRE_COMMIT_COLOR: always
- uses: pre-commit-ci/lite-action@5d6cc0eb514c891a40562a58a8e71576c5c7fb43 #v1.1.0
if: always()
with:
msg: Apply pre-commit code formatting
48 changes: 22 additions & 26 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ on:

jobs:
build:
permissions:
contents: read
pull-requests: write
strategy:
# We want to see all failures:
fail-fast: false
Expand All @@ -20,46 +23,39 @@ jobs:
- ["ubuntu", "ubuntu-latest"]
config:
# [Python version, tox env]
- ["3.11", "release-check"]
- ["3.11", "lint"]
- ["3.8", "py38"]
- ["3.9", "py39"]
- ["3.10", "py310"]
- ["3.11", "py311"]
- ["3.12", "py312"]
- ["3.11", "coverage"]
- ["3.11", "release-check"]
- ["3.9", "py39"]
- ["3.10", "py310"]
- ["3.11", "py311"]
- ["3.12", "py312"]
- ["3.13", "py313"]
- ["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
name: ${{ matrix.config[1] }}
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.config[0] }}
- name: Pip cache
uses: actions/cache@v4
persist-credentials: false
- name: Install uv + caching
uses: astral-sh/setup-uv@v5
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.config[0] }}-${{ hashFiles('setup.*', 'tox.ini') }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.config[0] }}-
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
enable-cache: true
cache-dependency-glob: |
setup.*
tox.ini
python-version: ${{ matrix.matrix.config[0] }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Test
if: ${{ !startsWith(runner.os, 'Mac') }}
run: tox -e ${{ matrix.config[1] }}
run: uvx --with tox-uv tox -e ${{ matrix.config[1] }}
- name: Test (macOS)
if: ${{ startsWith(runner.os, 'Mac') }}
run: tox -e ${{ matrix.config[1] }}-universal2
run: uvx --with tox-uv tox -e ${{ matrix.config[1] }}-universal2
- name: Coverage
if: matrix.config[1] == 'coverage'
run: |
pip install coveralls
coveralls --service=github
uvx coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4 changes: 2 additions & 2 deletions .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/zope-product
[meta]
template = "zope-product"
commit-id = "b1221c3c"
commit-id = "a0de4e93"

[python]
with-pypy = false
Expand All @@ -16,7 +16,7 @@ with-docs = false
use-flake8 = true

[coverage]
fail-under = 70
fail-under = 73

[coverage-run]
source = "src"
Expand Down
28 changes: 28 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/zope-product
minimum_pre_commit_version: '3.6'
repos:
- repo: https://github.com/pycqa/isort
rev: "6.0.1"
hooks:
- id: isort
- repo: https://github.com/hhatto/autopep8
rev: "v2.3.2"
hooks:
- id: autopep8
args: [--in-place, --aggressive, --aggressive]
- repo: https://github.com/asottile/pyupgrade
rev: v3.19.1
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.2"
hooks:
- id: flake8
additional_dependencies:
- flake8-debugger == 4.1.2
4 changes: 4 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ Changelog
----------------


- Add support for Python 3.13.

- Drop support for Python 3.8.

- Drop support for Python 3.7.

4.1 (2024-01-04)
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!--
Generated from:
https://github.com/zopefoundation/meta/tree/master/config/zope-product
-->
-->
# Contributing to zopefoundation projects

The projects under the zopefoundation GitHub organization are open source and
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 src *.py
recursive-include src *.dtml
Expand Down
32 changes: 32 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/zope-product

[build-system]
requires = [
"setuptools == 75.8.2",
"wheel",
]
build-backend = "setuptools.build_meta"

[tool.coverage.run]
branch = true
source = ["src"]

[tool.coverage.report]
fail_under = 73
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"
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
'/Products.ZSQLMethods/issues'),
'Sources': 'https://github.com/zopefoundation/Products.ZSQLMethods',
},
license='ZPL 2.1',
license='ZPL-2.1',
description='SQL method support for Zope.',
author='Zope Foundation and Contributors',
author_email='zope-dev@zope.dev',
Expand All @@ -47,16 +47,16 @@
'License :: OSI Approved :: Zope Public License',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3',
'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 :: Database',
'Topic :: Database :: Front-Ends',
],
python_requires='>=3.8',
python_requires='>=3.9',
install_requires=[
'setuptools',
'Zope >= 4.2.1',
Expand Down
4 changes: 2 additions & 2 deletions src/Shared/DC/ZRDB/Connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,8 @@ def connect(self, s):
except Exception:
t, v, tb = sys.exc_info()
raise BadRequest(
'<strong>Error connecting to DB.</strong><br>\n'
'<!--\n%s\n%s\n-->\n' % (t, v)).with_traceback(tb)
'<strong>Error connecting to DB.</strong><br>\n'
'<!--\n%s\n%s\n-->\n' % (t, v)).with_traceback(tb)
finally:
tb = None
self._v_connected = DateTime()
Expand Down
8 changes: 1 addition & 7 deletions src/Shared/DC/ZRDB/tests/testArgs.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@

import pickle
from unittest import TestCase
from unittest import TestSuite
from unittest import makeSuite


class TestArgs(TestCase):
Expand Down Expand Up @@ -56,7 +54,7 @@ def test_dict_getters(self):
args = self._makeOne({'arg1': {'type': 'string', 'default': 'n/a'}},
['arg1'])
self.assertIn('arg1', args)
self.assertTrue('arg1' in args)
self.assertIn('arg1', args)
self.assertDictEqual(args['arg1'],
{'default': 'n/a', 'type': 'string'})
self.assertEqual(args.keys(), ['arg1'])
Expand All @@ -81,7 +79,3 @@ def test__delitem__(self):

del args['arg2']
self.assertEqual(len(args), 0)


def test_suite():
return TestSuite((makeSuite(TestArgs),))
10 changes: 2 additions & 8 deletions src/Shared/DC/ZRDB/tests/testResult.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from io import StringIO
from unittest import TestCase
from unittest import TestSuite
from unittest import makeSuite

from ExtensionClass import Base

Expand Down Expand Up @@ -40,7 +38,7 @@ def test_results(self):
self.assertEqual(row.bar, 4)
self.assertEqual(row.FOO, 3)
self.assertEqual(row.BAR, 4)
self.assertTrue(isinstance(row, Brain))
self.assertIsInstance(row, Brain)

def test_rdb_file(self):
infile = StringIO("""\
Expand All @@ -67,8 +65,4 @@ def test_rdb_file(self):
self.assertEqual(row.bar, 4)
self.assertEqual(row.FOO, 3)
self.assertEqual(row.BAR, 4)
self.assertTrue(isinstance(row, Brain))


def test_suite():
return TestSuite((makeSuite(TestResults),))
self.assertIsInstance(row, Brain)
6 changes: 0 additions & 6 deletions src/Shared/DC/ZRDB/tests/testTHUNK.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
##############################################################################

from unittest import TestCase
from unittest import TestSuite
from unittest import makeSuite


class TestTM(TestCase):
Expand Down Expand Up @@ -55,7 +53,3 @@ def test_sortKey(self):

tm.setSortKey([])
self.assertEqual(tm.sortKey(), '[]')


def test_suite():
return TestSuite((makeSuite(TestTM),))
6 changes: 0 additions & 6 deletions src/Shared/DC/ZRDB/tests/testTM.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
##############################################################################

from unittest import TestCase
from unittest import TestSuite
from unittest import makeSuite


class TestTM(TestCase):
Expand Down Expand Up @@ -55,7 +53,3 @@ def test_sortKey(self):

tm.setSortKey([])
self.assertEqual(tm.sortKey(), '[]')


def test_suite():
return TestSuite((makeSuite(TestTM),))
10 changes: 0 additions & 10 deletions src/Shared/DC/ZRDB/tests/test_caching.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from pprint import pprint
from time import time
from unittest import TestCase
from unittest import TestSuite
from unittest import makeSuite


class DummyDB:
Expand Down Expand Up @@ -357,11 +355,3 @@ def test_cached_result_not_called_for_no_caching(self):
self.da.max_cache_ = 1
# check that we get an exception
self.assertRaises(TypeError, self.da)


def test_suite():
suite = TestSuite()
suite.addTest(makeSuite(TestCaching))
suite.addTest(makeSuite(TestCacheKeys))
suite.addTest(makeSuite(TestFullChain))
return suite
6 changes: 3 additions & 3 deletions src/Shared/DC/ZRDB/tests/test_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@ def test_getattr_and_aliases(self):
def test_suppliedbrain(self):
ob = self._makeOne((self.columns, self.data), brains=Brain)
row = ob[0]
self.assertTrue(isinstance(row, Brain))
self.assertIsInstance(row, Brain)

def test_suppliedparent(self):
ob = self._makeOne((self.columns, self.data), parent=Parent)
row = ob[0]
self.assertTrue(aq_parent(row) is Parent)
self.assertIs(aq_parent(row), Parent)

def test_tuples(self):
ob = self._makeOne((self.columns, self.data))
Expand Down Expand Up @@ -146,7 +146,7 @@ def test_record_of(self):
def test_record_hash(self):
ob = self._makeOne((self.columns, self.data))
row = ob[0]
self.assertTrue(isinstance(hash(row), int))
self.assertIsInstance(hash(row), int)

def test_record_len(self):
ob = self._makeOne((self.columns, self.data))
Expand Down
Loading