Skip to content

Commit

Permalink
Config with pure python (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Howitz committed May 26, 2021
1 parent a9a6438 commit 58e05f0
Show file tree
Hide file tree
Showing 14 changed files with 241 additions and 82 deletions.
11 changes: 0 additions & 11 deletions .coveragerc

This file was deleted.

39 changes: 39 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
#
# EditorConfig Configuration file, for more details see:
# http://EditorConfig.org
# EditorConfig is a convention description, that could be interpreted
# by multiple editors to enforce common coding conventions for specific
# file types

# top-most EditorConfig file:
# Will ignore other EditorConfig files in Home directory or upper tree level.
root = true


[*] # For All Files
# Unix-style newlines with a newline ending every file
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
# Set default charset
charset = utf-8
# Indent style default
indent_style = space
# Max Line Length - a hard line wrap, should be disabled
max_line_length = off

[*.{py,cfg,ini}]
# 4 space indentation
indent_size = 4

[*.{yml,zpt,pt,dtml}]
# 2 space indentation
indent_size = 2

[{Makefile,.gitmodules}]
# Tab indentation (no size specified, but view as 4 spaces)
indent_style = tab
indent_size = unset
tab_width = unset
60 changes: 60 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
name: tests

on:
push:
pull_request:
schedule:
- cron: '0 12 * * 0' # run once a week on Sunday
# Allow to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
build:
strategy:
# We want to see all failures:
fail-fast: false
matrix:
config:
# [Python version, tox env]
- ["3.8", "lint"]
- ["2.7", "py27"]
- ["3.5", "py35"]
- ["3.6", "py36"]
- ["3.7", "py37"]
- ["3.8", "py38"]
- ["3.9", "py39"]
- ["pypy2", "pypy"]
- ["pypy3", "pypy3"]
- ["3.8", "coverage"]

runs-on: ubuntu-latest
name: ${{ matrix.config[1] }}
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.config[0] }}
- name: Pip cache
uses: actions/cache@v2
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
- name: Test
run: tox -e ${{ matrix.config[1] }}
- name: Coverage
if: matrix.config[1] == 'coverage'
run: |
pip install coveralls coverage-python-version
coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32 changes: 26 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,29 @@
.installed.cfg
*.pyc
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
*.egg-info/
*.profraw
*.pyc
*.pyo
.coverage
.coverage.*
.eggs/
.installed.cfg
.mr.developer.cfg
.tox/
.vscode/
__pycache__/
bin/
parts/
build/
coverage.xml
develop-eggs/
.tox/
.coverage
htmlcov/
develop/
dist/
docs/_build
eggs/
etc/
lib/
lib64
log/
parts/
pyvenv.cfg
var/
27 changes: 27 additions & 0 deletions .meta.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
[meta]
template = "pure-python"
commit-id = "d4e8550e4a37df10866d376fceac4e91689df8c5"

[python]
with-appveyor = true
with-pypy = true
with-legacy-python = true
with-docs = false
with-sphinx-doctests = false

[tox]
use-flake8 = true
testenv-deps = [
"wheel",
]

[coverage]
fail-under = 99

[manifest]
additional-rules = [
"include test.ini",
"recursive-include src *.rst",
]
29 changes: 0 additions & 29 deletions .travis.yml

This file was deleted.

18 changes: 8 additions & 10 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
include *.py
include *.txt
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
include *.rst
include .travis.yml
include tox.ini
include .coveragerc
include *.txt
include buildout.cfg
include test.ini

recursive-include src *.txt *.py *.rst
include tox.ini
include appveyor.yml

# added by check_manifest.py
include *.yml
recursive-include src *.py
include test.ini
recursive-include src *.rst
22 changes: 19 additions & 3 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
environment:

matrix:
Expand All @@ -15,12 +17,26 @@ environment:
- python: 39-x64

install:
- "SET PYTHONVERSION=%PYTHON%"
- "SET PATH=C:\\Python%PYTHON%;c:\\Python%PYTHON%\\scripts;%PATH%"
- ps: |
$env:PYTHON = "C:\\Python${env:PYTHON}"
if (-not (Test-Path $env:PYTHON)) {
curl -o install_python.ps1 https://raw.githubusercontent.com/matthew-brett/multibuild/11a389d78892cf90addac8f69433d5e22bfa422a/install_python.ps1
.\install_python.ps1
}
- ps: if (-not (Test-Path $env:PYTHON)) { throw "No $env:PYTHON" }
- echo "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64 > "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64\vcvars64.bat"
- pip install -U setuptools
- pip install -e .[test]
- python -m pip install -U pip
- pip install -U setuptools wheel
- pip install -U -e .[test]

build: false
matrix:
fast_finish: true

test_script:
- zope-testrunner --test-path=src -pvc
- zope-testrunner --test-path=src

on_success:
- echo Build succesful!
10 changes: 10 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,2 +1,12 @@
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
[bdist_wheel]
universal = 1

[flake8]
doctests = 1

[check-manifest]
ignore =
.editorconfig
.meta.toml
2 changes: 1 addition & 1 deletion src/zope/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__import__('pkg_resources').declare_namespace(__name__)
__import__('pkg_resources').declare_namespace(__name__) # pragma: no cover
2 changes: 1 addition & 1 deletion src/zope/server/http/tests/test_chunking.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def _do_test(self, data, expected=b'oh hai'):
if isinstance(data, bytes):
reader = self._makeOne()
for c in data:
if str is not bytes:
if str is not bytes: # pragma: PY3
# sigh. Py3 iterates bytes as ints
c = bytes((c,))
reader.received(c)
Expand Down
2 changes: 1 addition & 1 deletion src/zope/server/linereceiver/linecommandparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def received(self, data):
self.inbuf = self.inbuf + s
self.completed = 1
line = self.inbuf.strip()
if PY3:
if PY3: # pragma: PY3
line = line.decode('utf-8')
self.parseLine(line)
return len(s)
Expand Down
1 change: 0 additions & 1 deletion src/zope/server/tests/test_zombies.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ def zombies_test():
channel older than the configured timeout will be closed when a new channel
is created, regardless of activity.
>>> import time
>>> import zope.server.adjustments
>>> config = zope.server.adjustments.Adjustments()
Expand Down
68 changes: 49 additions & 19 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,30 +1,27 @@
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
[tox]
minversion = 3.18
envlist =
lint,
py27,
pypy,
py35,
py36,
py37,
py38,
py39,
pypy,
pypy3,
lint
py27
py35
py36
py37
py38
py39
pypy
pypy3
coverage

[testenv]
extras = test
commands =
zope-testrunner --test-path=src {posargs:-pvc}

[testenv:coverage]
usedevelop = true
basepython = python3.6
deps =
coverage
wheel
commands =
coverage run -m zope.testrunner --test-path=src {posargs:-pvc}
coverage report -m --fail-under=100
zope-testrunner --test-path=src {posargs:-vc}
extras =
test

[testenv:lint]
basepython = python3
Expand All @@ -37,3 +34,36 @@ commands =
flake8 src setup.py
check-manifest
check-python-versions

[testenv:coverage]
basepython = python3
allowlist_externals =
mkdir
deps =
coverage
coverage-python-version
wheel
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:run]
branch = True
plugins = coverage_python_version
source = src

[coverage:report]
precision = 2
exclude_lines =
pragma: no cover
pragma: nocover
except ImportError:
raise NotImplementedError
if __name__ == '__main__':
self.fail
raise AssertionError

[coverage:html]
directory = parts/htmlcov

0 comments on commit 58e05f0

Please sign in to comment.