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 to latest meta/config templates #66

Merged
merged 3 commits into from
Sep 4, 2024
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/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:
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.0.2
if: always()
with:
msg: Apply pre-commit code formatting
2 changes: 0 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ jobs:
config:
# [Python version, tox env]
- ["3.11", "release-check"]
- ["3.11", "lint"]
- ["3.8", "py38"]
- ["3.9", "py39"]
- ["3.10", "py310"]
Expand All @@ -33,7 +32,6 @@ jobs:
- ["3.11", "coverage"]
exclude:
- { os: ["windows", "windows-latest"], config: ["3.11", "release-check"] }
- { os: ["windows", "windows-latest"], config: ["3.11", "lint"] }
- { os: ["windows", "windows-latest"], config: ["3.11", "coverage"] }

runs-on: ${{ matrix.os[1] }}
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/zope-product
[meta]
template = "zope-product"
commit-id = "b1221c3c"
commit-id = "acd39fc2"

[python]
with-pypy = true
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: "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.17.0
hooks:
- id: pyupgrade
args: [--py38-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
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 *.txt
22 changes: 14 additions & 8 deletions src/DateTime/tests/test_datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def _compare(self, dt1, dt2):
def testBug1203(self):
# 01:59:60 occurred in old DateTime
dt = DateTime(7200, 'GMT')
self.assertTrue(str(dt).find('60') < 0, dt)
self.assertNotIn('60', str(dt))

def testDSTInEffect(self):
# Checks GMT offset for a DST date in the US/Eastern time zone
Expand Down Expand Up @@ -172,7 +172,7 @@ def testOldDate(self):
# Fails when an 1800 date is displayed with negative signs
dt = DateTime('1830/5/6 12:31:46.213 pm')
dt1 = dt.toZone('GMT+6')
self.assertTrue(str(dt1).find('-') < 0, (dt, dt1))
self.assertNotIn('-', str(dt1))

def testSubtraction(self):
# Reconstruction of a DateTime from its parts, with subtraction
Expand Down Expand Up @@ -219,8 +219,10 @@ def test_compare_methods(self):
self.assertFalse(dt.equalTo(dt1))
# Compare a date to float
dt = DateTime(1.0)
self.assertTrue(dt == DateTime(1.0)) # testing __eq__
self.assertFalse(dt != DateTime(1.0)) # testing __ne__
is_eq = dt == DateTime(1.0) # testing __eq__
self.assertTrue(is_eq)
is_neq = dt != DateTime(1.0) # testing __ne__
self.assertFalse(is_neq)
self.assertFalse(dt.greaterThan(1.0))
self.assertTrue(dt.greaterThanEqualTo(1.0))
self.assertFalse(dt.lessThan(1.0))
Expand All @@ -230,8 +232,10 @@ def test_compare_methods(self):
# Compare a date to int
dt = DateTime(1)
self.assertEqual(dt, DateTime(1.0))
self.assertTrue(dt == DateTime(1)) # testing __eq__
self.assertFalse(dt != DateTime(1)) # testing __ne__
is_eq = dt == DateTime(1) # testing __eq__
self.assertTrue(is_eq)
is_neq = dt != DateTime(1) # testing __ne__
self.assertFalse(is_neq)
self.assertFalse(dt.greaterThan(1))
self.assertTrue(dt.greaterThanEqualTo(1))
self.assertFalse(dt.lessThan(1))
Expand All @@ -242,8 +246,10 @@ def test_compare_methods(self):
# but behavior if consistent as when comparing, for example, an int
# and a string.
dt = DateTime("2023")
self.assertFalse(dt == "2023") # testing __eq__
self.assertTrue(dt != "2023") # testing __ne__
is_eq = dt == "2023" # testing __eq__
self.assertFalse(is_eq)
is_neq = dt != "2023" # testing __ne__
self.assertTrue(is_neq)
self.assertRaises(TypeError, dt.greaterThan, "2023")
self.assertRaises(TypeError, dt.greaterThanEqualTo, "2023")
self.assertRaises(TypeError, dt.lessThan, "2023")
Expand Down
28 changes: 7 additions & 21 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ envlist =
[testenv]
skip_install = true
deps =
setuptools < 69
zc.buildout >= 3.0.1
setuptools <74
zc.buildout >= 3.1
wheel > 0.37
setenv =
py312: VIRTUALENV_PIP=23.1.2
Expand All @@ -28,6 +28,7 @@ commands_pre =
commands =
{envbindir}/test {posargs:-cv}


[testenv:release-check]
description = ensure that the distribution is ready to release
basepython = python3
Expand All @@ -46,29 +47,14 @@ commands =
twine check dist/*

[testenv:lint]
description = This env runs all linters configured in .pre-commit-config.yaml
basepython = python3
commands_pre =
mkdir -p {toxinidir}/parts/flake8
allowlist_externals =
mkdir
commands =
isort --check-only --diff {toxinidir}/src {toxinidir}/setup.py
flake8 {toxinidir}/src {toxinidir}/setup.py
skip_install = true
deps =
flake8
isort
# Useful flake8 plugins that are Python and Plone specific:
flake8-coding
flake8-debugger
mccabe

[testenv:isort-apply]
basepython = python3
pre-commit
commands_pre =
deps =
isort
commands =
isort {toxinidir}/src {toxinidir}/setup.py []
pre-commit run --all-files --show-diff-on-failure

[testenv:coverage]
basepython = python3
Expand Down