Skip to content

Commit

Permalink
Merge pull request #66 from zopefoundation/config-with-zope-product-t…
Browse files Browse the repository at this point in the history
…emplate-acd39fc2

Update to latest meta/config templates
  • Loading branch information
dataflake authored Sep 4, 2024
2 parents e0c8be8 + 28d6788 commit e95b160
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 32 deletions.
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

0 comments on commit e95b160

Please sign in to comment.