diff options
author | Bert JW Regeer <xistence@0x58.com> | 2020-04-17 00:31:28 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-17 00:31:28 -0700 |
commit | 154fa82925c876ddfc8caa0398572c9b1e0696d3 (patch) | |
tree | 212c3729fbd577cd1f526a906fc8a066a630cabc | |
parent | fc4a5ebaf94a5a0a73900e86f8a55895d0204e2f (diff) | |
parent | a2962aed85e5dbe1688a93b2f7f76202cd395eb3 (diff) | |
download | waitress-154fa82925c876ddfc8caa0398572c9b1e0696d3.tar.gz |
Merge pull request #280 from Pylons/bestpractices
Updates Waitress to best practices surrounding packaging
-rw-r--r-- | .coveragerc | 7 | ||||
-rw-r--r-- | .flake8 | 36 | ||||
-rw-r--r-- | .github/workflows/ci-linux.yml | 18 | ||||
-rw-r--r-- | .gitignore | 8 | ||||
-rw-r--r-- | .travis.yml | 41 | ||||
-rw-r--r-- | MANIFEST.in | 21 | ||||
-rw-r--r-- | appveyor.yml | 27 | ||||
-rw-r--r-- | docs/.gitignore | 4 | ||||
-rw-r--r-- | pyproject.toml | 12 | ||||
-rw-r--r-- | setup.cfg | 72 | ||||
-rw-r--r-- | setup.py | 80 | ||||
-rw-r--r-- | src/waitress/__init__.py (renamed from waitress/__init__.py) | 0 | ||||
-rw-r--r-- | src/waitress/__main__.py (renamed from waitress/__main__.py) | 0 | ||||
-rw-r--r-- | src/waitress/adjustments.py (renamed from waitress/adjustments.py) | 0 | ||||
-rw-r--r-- | src/waitress/buffers.py (renamed from waitress/buffers.py) | 0 | ||||
-rw-r--r-- | src/waitress/channel.py (renamed from waitress/channel.py) | 0 | ||||
-rw-r--r-- | src/waitress/compat.py (renamed from waitress/compat.py) | 0 | ||||
-rw-r--r-- | src/waitress/parser.py (renamed from waitress/parser.py) | 1 | ||||
-rw-r--r-- | src/waitress/proxy_headers.py (renamed from waitress/proxy_headers.py) | 0 | ||||
-rw-r--r-- | src/waitress/receiver.py (renamed from waitress/receiver.py) | 0 | ||||
-rw-r--r-- | src/waitress/rfc7230.py (renamed from waitress/rfc7230.py) | 0 | ||||
-rw-r--r-- | src/waitress/runner.py (renamed from waitress/runner.py) | 0 | ||||
-rw-r--r-- | src/waitress/server.py (renamed from waitress/server.py) | 0 | ||||
-rw-r--r-- | src/waitress/task.py (renamed from waitress/task.py) | 0 | ||||
-rw-r--r-- | src/waitress/trigger.py (renamed from waitress/trigger.py) | 0 | ||||
-rw-r--r-- | src/waitress/utilities.py (renamed from waitress/utilities.py) | 0 | ||||
-rw-r--r-- | src/waitress/wasyncore.py (renamed from waitress/wasyncore.py) | 0 | ||||
-rw-r--r-- | tests/__init__.py (renamed from waitress/tests/__init__.py) | 0 | ||||
-rw-r--r-- | tests/fixtureapps/__init__.py (renamed from waitress/tests/fixtureapps/__init__.py) | 0 | ||||
-rw-r--r-- | tests/fixtureapps/badcl.py (renamed from waitress/tests/fixtureapps/badcl.py) | 0 | ||||
-rw-r--r-- | tests/fixtureapps/echo.py (renamed from waitress/tests/fixtureapps/echo.py) | 0 | ||||
-rw-r--r-- | tests/fixtureapps/error.py (renamed from waitress/tests/fixtureapps/error.py) | 0 | ||||
-rw-r--r-- | tests/fixtureapps/filewrapper.py (renamed from waitress/tests/fixtureapps/filewrapper.py) | 0 | ||||
-rw-r--r-- | tests/fixtureapps/getline.py (renamed from waitress/tests/fixtureapps/getline.py) | 0 | ||||
-rw-r--r-- | tests/fixtureapps/groundhog1.jpg (renamed from waitress/tests/fixtureapps/groundhog1.jpg) | bin | 45448 -> 45448 bytes | |||
-rw-r--r-- | tests/fixtureapps/nocl.py (renamed from waitress/tests/fixtureapps/nocl.py) | 0 | ||||
-rw-r--r-- | tests/fixtureapps/runner.py (renamed from waitress/tests/fixtureapps/runner.py) | 0 | ||||
-rw-r--r-- | tests/fixtureapps/sleepy.py (renamed from waitress/tests/fixtureapps/sleepy.py) | 0 | ||||
-rw-r--r-- | tests/fixtureapps/toolarge.py (renamed from waitress/tests/fixtureapps/toolarge.py) | 0 | ||||
-rw-r--r-- | tests/fixtureapps/writecb.py (renamed from waitress/tests/fixtureapps/writecb.py) | 0 | ||||
-rw-r--r-- | tests/test_adjustments.py (renamed from waitress/tests/test_adjustments.py) | 0 | ||||
-rw-r--r-- | tests/test_buffers.py (renamed from waitress/tests/test_buffers.py) | 0 | ||||
-rw-r--r-- | tests/test_channel.py (renamed from waitress/tests/test_channel.py) | 0 | ||||
-rw-r--r-- | tests/test_compat.py (renamed from waitress/tests/test_compat.py) | 0 | ||||
-rw-r--r-- | tests/test_functional.py (renamed from waitress/tests/test_functional.py) | 39 | ||||
-rw-r--r-- | tests/test_init.py (renamed from waitress/tests/test_init.py) | 0 | ||||
-rw-r--r-- | tests/test_parser.py (renamed from waitress/tests/test_parser.py) | 0 | ||||
-rw-r--r-- | tests/test_proxy_headers.py (renamed from waitress/tests/test_proxy_headers.py) | 0 | ||||
-rw-r--r-- | tests/test_receiver.py (renamed from waitress/tests/test_receiver.py) | 0 | ||||
-rw-r--r-- | tests/test_regression.py (renamed from waitress/tests/test_regression.py) | 0 | ||||
-rw-r--r-- | tests/test_runner.py (renamed from waitress/tests/test_runner.py) | 10 | ||||
-rw-r--r-- | tests/test_server.py (renamed from waitress/tests/test_server.py) | 0 | ||||
-rw-r--r-- | tests/test_task.py (renamed from waitress/tests/test_task.py) | 0 | ||||
-rw-r--r-- | tests/test_trigger.py (renamed from waitress/tests/test_trigger.py) | 0 | ||||
-rw-r--r-- | tests/test_utilities.py (renamed from waitress/tests/test_utilities.py) | 0 | ||||
-rw-r--r-- | tests/test_wasyncore.py (renamed from waitress/tests/test_wasyncore.py) | 0 | ||||
-rw-r--r-- | tox.ini | 104 |
57 files changed, 255 insertions, 225 deletions
diff --git a/.coveragerc b/.coveragerc index cbacd63..b869097 100644 --- a/.coveragerc +++ b/.coveragerc @@ -5,10 +5,15 @@ concurrency = multiprocessing source = waitress - omit = waitress/tests/fixtureapps/getline.py +[paths] +source = + src/waitress + */src/waitress + */site-packages/waitress + [report] show_missing = true precision = 2 @@ -0,0 +1,36 @@ +# Recommended flake8 settings while editing, we use Black for the final linting/say in how code is formatted +# +# pip install flake8 flake8-bugbear +# +# This will warn/error on things that black does not fix, on purpose. +# +# Run: +# +# tox -e run-flake8 +# +# To have it automatically create and install the appropriate tools, and run +# flake8 across the source code/tests + +[flake8] +# max line length is set to 88 in black, here it is set to 80 and we enable bugbear's B950 warning, which is: +# +# B950: Line too long. This is a pragmatic equivalent of pycodestyle’s E501: it +# considers “max-line-length” but only triggers when the value has been +# exceeded by more than 10%. You will no longer be forced to reformat code due +# to the closing parenthesis being one character too far to satisfy the linter. +# At the same time, if you do significantly violate the line length, you will +# receive a message that states what the actual limit is. This is inspired by +# Raymond Hettinger’s “Beyond PEP 8” talk and highway patrol not stopping you +# if you drive < 5mph too fast. Disable E501 to avoid duplicate warnings. +max-line-length = 80 +max-complexity = 12 +select = E,F,W,C,B,B9 +ignore = + # E123 closing bracket does not match indentation of opening bracket’s line + E123 + # E203 whitespace before ‘:’ (Not PEP8 compliant, Python Black) + E203 + # E501 line too long (82 > 79 characters) (replaced by B950 from flake8-bugbear, https://github.com/PyCQA/flake8-bugbear) + E501 + # W503 line break before binary operator (Not PEP8 compliant, Python Black) + W503 diff --git a/.github/workflows/ci-linux.yml b/.github/workflows/ci-linux.yml index cc5639a..1a8897f 100644 --- a/.github/workflows/ci-linux.yml +++ b/.github/workflows/ci-linux.yml @@ -40,10 +40,10 @@ jobs: - name: Setup python uses: actions/setup-python@v1 with: - python-version: 3.5 + python-version: 3.8 architecture: x64 - run: pip install tox - - run: tox -e py35-cover,py27-cover,coverage + - run: tox -e py38,py27,coverage docs: runs-on: ubuntu-latest name: Build the documentation @@ -52,7 +52,19 @@ jobs: - name: Setup python uses: actions/setup-python@v1 with: - python-version: 3.5 + python-version: 3.8 architecture: x64 - run: pip install tox - run: tox -e docs + lint: + runs-on: ubuntu-latest + name: Lint the package + steps: + - uses: actions/checkout@master + - name: Setup python + uses: actions/setup-python@v1 + with: + python-version: 3.8 + architecture: x64 + - run: pip install tox + - run: tox -e lint @@ -3,13 +3,9 @@ env*/ .coverage .coverage.* -.idea/ .tox/ -nosetests.xml -waitress/coverage.xml dist/ -keep/ build/ coverage.xml -nosetests*.xml -py*-cover.xml +docs/_themes +docs/_build diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 4bb2567..0000000 --- a/.travis.yml +++ /dev/null @@ -1,41 +0,0 @@ -# Wire up travis -language: python -sudo: false - -matrix: - include: - - python: 2.7 - env: TOXENV=py27 - - python: 3.5 - env: TOXENV=py35 - - python: 3.6 - env: TOXENV=py36 - - python: 3.7 - env: TOXENV=py37 - dist: xenial - sudo: true - - python: 3.8 - env: TOXENV=py38 - dist: xenial - sudo: true - - python: pypy - env: TOXENV=pypy - - python: pypy3 - env: TOXENV=pypy3 - - python: 3.5 - env: TOXENV=py27-cover,py35-cover,coverage - - python: 3.5 - env: TOXENV=docs - -install: - - travis_retry pip install tox - -script: - - travis_retry tox - -notifications: - email: - - pyramid-checkins@lists.repoze.org - irc: - channels: - - "chat.freenode.net#pyramid" diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..7540038 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,21 @@ +graft src/waitress +graft tests +graft docs +graft .github + +include README.rst +include CHANGES.txt +include HISTORY.txt +include RELEASING.txt +include LICENSE.txt +include contributing.md +include CONTRIBUTORS.txt +include COPYRIGHT.txt + +include pyproject.toml setup.cfg +include .coveragerc .flake8 +include tox.ini rtd.txt + +exclude TODO.txt + +recursive-exclude * __pycache__ *.py[cod] diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 48cb759..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,27 +0,0 @@ -environment: - matrix: - - PYTHON: "C:\\Python27" - TOXENV: "py27" - - PYTHON: "C:\\Python27-x64" - TOXENV: "py27" - - PYTHON: "C:\\Python36" - TOXENV: "py36" - - PYTHON: "C:\\Python36-x64" - TOXENV: "py36" - - PYTHON: "C:\\Python37" - TOXENV: "py37" - - PYTHON: "C:\\Python37-x64" - TOXENV: "py37" - -cache: - - '%LOCALAPPDATA%\pip\Cache' - -version: '{branch}.{build}' - -install: - - "%PYTHON%\\python.exe -m pip install tox" - -build: off - -test_script: - - "%PYTHON%\\Scripts\\tox.exe" diff --git a/docs/.gitignore b/docs/.gitignore deleted file mode 100644 index da7abd0..0000000 --- a/docs/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -_themes -_build - - diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..7f50ece --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,12 @@ +[build-system] +requires = ["setuptools >= 41"] +build-backend = "setuptools.build_meta" + +[tool.black] +py36 = false +exclude = ''' +/( + \.git + | .tox +)/ +''' @@ -1,15 +1,67 @@ -[easy_install] -zip_ok = false +[metadata] +name = waitress +version = 1.4.4a0 +description = Waitress WSGI server +long_description = file: README.rst, CHANGES.txt +long_description_content_type = text/x-rst +keywords = waitress wsgi server http +license = ZPL 2.1 +classifiers = + Development Status :: 6 - Mature + Environment :: Web Environment + Intended Audience :: Developers + License :: OSI Approved :: Zope Public License + Programming Language :: Python + Programming Language :: Python :: 2 + Programming Language :: Python :: 2.7 + Programming Language :: Python :: 3 + Programming Language :: Python :: 3.5 + Programming Language :: Python :: 3.6 + Programming Language :: Python :: 3.7 + Programming Language :: Python :: Implementation :: CPython + Programming Language :: Python :: Implementation :: PyPy + Operating System :: OS Independent + Topic :: Internet :: WWW/HTTP + Topic :: Internet :: WWW/HTTP :: WSGI +url = https://github.com/Pylons/waitress +author = Zope Foundation and Contributors +author_email = zope-dev@zope.org +maintainer = Pylons Project +maintainer_email = pylons-discuss@googlegroups.com -[nosetests] -match=^test -nocapture=1 -cover-package=waitress -cover-erase=1 +[options] +package_dir= + =src +packages=find: +python_requires = >=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.* + +[options.entry_points] +paste.server_runner = + main = waitress:serve_paste +console_scripts = + waitress-serve = waitress.runner:run + +[options.packages.find] +where=src + +[options.extras_require] +testing = + pytest + pytest-cover + coverage>=5.0 + +docs = + Sphinx>=1.8.1 + docutils + pylons-sphinx-themes>=1.0.9 [bdist_wheel] universal = 1 -[aliases] -dev = develop easy_install waitress[testing] -docs = develop easy_install waitress[docs] +[tool:pytest] +python_files = test_*.py +# For the benefit of test_wasyncore.py +python_classes = Test_* +testpaths = + tests +addopts = -W always --cov --cov-report=term-missing @@ -1,79 +1,3 @@ -############################################################################## -# -# Copyright (c) 2006 Zope Foundation and Contributors. -# All Rights Reserved. -# -# This software is subject to the provisions of the Zope Public License, -# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. -# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED -# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS -# FOR A PARTICULAR PURPOSE. -# -############################################################################## -import os +from setuptools import setup -from setuptools import find_packages, setup - -here = os.path.abspath(os.path.dirname(__file__)) -try: - README = open(os.path.join(here, "README.rst")).read() - CHANGES = open(os.path.join(here, "CHANGES.txt")).read() -except IOError: - README = CHANGES = "" - -docs_extras = [ - "Sphinx>=1.8.1", - "docutils", - "pylons-sphinx-themes>=1.0.9", -] - -testing_extras = [ - "nose", - "coverage>=5.0", -] - -setup( - name="waitress", - version="1.4.3", - author="Zope Foundation and Contributors", - author_email="zope-dev@zope.org", - maintainer="Pylons Project", - maintainer_email="pylons-discuss@googlegroups.com", - description="Waitress WSGI server", - long_description=README + "\n\n" + CHANGES, - license="ZPL 2.1", - keywords="waitress wsgi server http", - classifiers=[ - "Development Status :: 5 - Production/Stable", - "Environment :: Web Environment", - "Intended Audience :: Developers", - "License :: OSI Approved :: Zope Public License", - "Programming Language :: Python", - "Programming Language :: Python :: 2", - "Programming Language :: Python :: 2.7", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.5", - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: Implementation :: CPython", - "Programming Language :: Python :: Implementation :: PyPy", - "Natural Language :: English", - "Operating System :: OS Independent", - "Topic :: Internet :: WWW/HTTP", - "Topic :: Internet :: WWW/HTTP :: WSGI", - ], - url="https://github.com/Pylons/waitress", - packages=find_packages(), - python_requires=">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*", - extras_require={"testing": testing_extras, "docs": docs_extras}, - include_package_data=True, - test_suite="waitress", - zip_safe=False, - entry_points=""" - [paste.server_runner] - main = waitress:serve_paste - [console_scripts] - waitress-serve = waitress.runner:run - """, -) +setup() diff --git a/waitress/__init__.py b/src/waitress/__init__.py index e6e5911..e6e5911 100644 --- a/waitress/__init__.py +++ b/src/waitress/__init__.py diff --git a/waitress/__main__.py b/src/waitress/__main__.py index 9bcd07e..9bcd07e 100644 --- a/waitress/__main__.py +++ b/src/waitress/__main__.py diff --git a/waitress/adjustments.py b/src/waitress/adjustments.py index 93439ea..93439ea 100644 --- a/waitress/adjustments.py +++ b/src/waitress/adjustments.py diff --git a/waitress/buffers.py b/src/waitress/buffers.py index 04f6b42..04f6b42 100644 --- a/waitress/buffers.py +++ b/src/waitress/buffers.py diff --git a/waitress/channel.py b/src/waitress/channel.py index a8bc76f..a8bc76f 100644 --- a/waitress/channel.py +++ b/src/waitress/channel.py diff --git a/waitress/compat.py b/src/waitress/compat.py index fe72a76..fe72a76 100644 --- a/waitress/compat.py +++ b/src/waitress/compat.py diff --git a/waitress/parser.py b/src/waitress/parser.py index 53072b5..765fe59 100644 --- a/waitress/parser.py +++ b/src/waitress/parser.py @@ -39,6 +39,7 @@ class ParsingError(Exception): class TransferEncodingNotImplemented(Exception): pass + class HTTPRequestParser(object): """A structure that collects the HTTP request. diff --git a/waitress/proxy_headers.py b/src/waitress/proxy_headers.py index 1df8b8e..1df8b8e 100644 --- a/waitress/proxy_headers.py +++ b/src/waitress/proxy_headers.py diff --git a/waitress/receiver.py b/src/waitress/receiver.py index 5d1568d..5d1568d 100644 --- a/waitress/receiver.py +++ b/src/waitress/receiver.py diff --git a/waitress/rfc7230.py b/src/waitress/rfc7230.py index cd33c90..cd33c90 100644 --- a/waitress/rfc7230.py +++ b/src/waitress/rfc7230.py diff --git a/waitress/runner.py b/src/waitress/runner.py index 2495084..2495084 100644 --- a/waitress/runner.py +++ b/src/waitress/runner.py diff --git a/waitress/server.py b/src/waitress/server.py index ae56699..ae56699 100644 --- a/waitress/server.py +++ b/src/waitress/server.py diff --git a/waitress/task.py b/src/waitress/task.py index 8e7ab18..8e7ab18 100644 --- a/waitress/task.py +++ b/src/waitress/task.py diff --git a/waitress/trigger.py b/src/waitress/trigger.py index 6a57c12..6a57c12 100644 --- a/waitress/trigger.py +++ b/src/waitress/trigger.py diff --git a/waitress/utilities.py b/src/waitress/utilities.py index 556bed2..556bed2 100644 --- a/waitress/utilities.py +++ b/src/waitress/utilities.py diff --git a/waitress/wasyncore.py b/src/waitress/wasyncore.py index 09bcafa..09bcafa 100644 --- a/waitress/wasyncore.py +++ b/src/waitress/wasyncore.py diff --git a/waitress/tests/__init__.py b/tests/__init__.py index b711d36..b711d36 100644 --- a/waitress/tests/__init__.py +++ b/tests/__init__.py diff --git a/waitress/tests/fixtureapps/__init__.py b/tests/fixtureapps/__init__.py index f215a2b..f215a2b 100644 --- a/waitress/tests/fixtureapps/__init__.py +++ b/tests/fixtureapps/__init__.py diff --git a/waitress/tests/fixtureapps/badcl.py b/tests/fixtureapps/badcl.py index 24067de..24067de 100644 --- a/waitress/tests/fixtureapps/badcl.py +++ b/tests/fixtureapps/badcl.py diff --git a/waitress/tests/fixtureapps/echo.py b/tests/fixtureapps/echo.py index 813bdac..813bdac 100644 --- a/waitress/tests/fixtureapps/echo.py +++ b/tests/fixtureapps/echo.py diff --git a/waitress/tests/fixtureapps/error.py b/tests/fixtureapps/error.py index 5afb1c5..5afb1c5 100644 --- a/waitress/tests/fixtureapps/error.py +++ b/tests/fixtureapps/error.py diff --git a/waitress/tests/fixtureapps/filewrapper.py b/tests/fixtureapps/filewrapper.py index 63df5a6..63df5a6 100644 --- a/waitress/tests/fixtureapps/filewrapper.py +++ b/tests/fixtureapps/filewrapper.py diff --git a/waitress/tests/fixtureapps/getline.py b/tests/fixtureapps/getline.py index 5e0ad3a..5e0ad3a 100644 --- a/waitress/tests/fixtureapps/getline.py +++ b/tests/fixtureapps/getline.py diff --git a/waitress/tests/fixtureapps/groundhog1.jpg b/tests/fixtureapps/groundhog1.jpg Binary files differindex 90f610e..90f610e 100644 --- a/waitress/tests/fixtureapps/groundhog1.jpg +++ b/tests/fixtureapps/groundhog1.jpg diff --git a/waitress/tests/fixtureapps/nocl.py b/tests/fixtureapps/nocl.py index f82bba0..f82bba0 100644 --- a/waitress/tests/fixtureapps/nocl.py +++ b/tests/fixtureapps/nocl.py diff --git a/waitress/tests/fixtureapps/runner.py b/tests/fixtureapps/runner.py index 1d66ad1..1d66ad1 100644 --- a/waitress/tests/fixtureapps/runner.py +++ b/tests/fixtureapps/runner.py diff --git a/waitress/tests/fixtureapps/sleepy.py b/tests/fixtureapps/sleepy.py index 2d171d8..2d171d8 100644 --- a/waitress/tests/fixtureapps/sleepy.py +++ b/tests/fixtureapps/sleepy.py diff --git a/waitress/tests/fixtureapps/toolarge.py b/tests/fixtureapps/toolarge.py index a0f36d2..a0f36d2 100644 --- a/waitress/tests/fixtureapps/toolarge.py +++ b/tests/fixtureapps/toolarge.py diff --git a/waitress/tests/fixtureapps/writecb.py b/tests/fixtureapps/writecb.py index e1d2792..e1d2792 100644 --- a/waitress/tests/fixtureapps/writecb.py +++ b/tests/fixtureapps/writecb.py diff --git a/waitress/tests/test_adjustments.py b/tests/test_adjustments.py index 303c1aa..303c1aa 100644 --- a/waitress/tests/test_adjustments.py +++ b/tests/test_adjustments.py diff --git a/waitress/tests/test_buffers.py b/tests/test_buffers.py index a1330ac..a1330ac 100644 --- a/waitress/tests/test_buffers.py +++ b/tests/test_buffers.py diff --git a/waitress/tests/test_channel.py b/tests/test_channel.py index 14ef5a0..14ef5a0 100644 --- a/waitress/tests/test_channel.py +++ b/tests/test_channel.py diff --git a/waitress/tests/test_compat.py b/tests/test_compat.py index 37c2193..37c2193 100644 --- a/waitress/tests/test_compat.py +++ b/tests/test_compat.py diff --git a/waitress/tests/test_functional.py b/tests/test_functional.py index 8f4b262..e894497 100644 --- a/waitress/tests/test_functional.py +++ b/tests/test_functional.py @@ -38,6 +38,7 @@ def try_register_coverage(): # pragma: no cover # atexit handler by always registering a signal handler if "COVERAGE_PROCESS_START" in os.environ: + def sigterm(*args): sys.exit(0) @@ -126,7 +127,7 @@ class SleepyThreadTests(TcpTests, unittest.TestCase): # test that sleepy thread doesnt block other requests def setUp(self): - from waitress.tests.fixtureapps import sleepy + from tests.fixtureapps import sleepy self.start_subprocess(sleepy.app) @@ -159,7 +160,7 @@ class SleepyThreadTests(TcpTests, unittest.TestCase): class EchoTests(object): def setUp(self): - from waitress.tests.fixtureapps import echo + from tests.fixtureapps import echo self.start_subprocess( echo.app, @@ -173,7 +174,7 @@ class EchoTests(object): self.stop_subprocess() def _read_echo(self, fp): - from waitress.tests.fixtureapps import echo + from tests.fixtureapps import echo line, headers, body = read_http(fp) return line, headers, echo.parse_response(body) @@ -336,7 +337,8 @@ class EchoTests(object): cl = int(headers["content-length"]) self.assertEqual(cl, len(response_body)) self.assertEqual( - sorted(headers.keys()), ["connection", "content-length", "content-type", "date", "server"] + sorted(headers.keys()), + ["connection", "content-length", "content-type", "date", "server"], ) self.assertEqual(headers["content-type"], "text/plain") # connection has been closed @@ -361,7 +363,8 @@ class EchoTests(object): self.assertEqual(cl, len(response_body)) self.assertTrue(b"Chunk not properly terminated" in response_body) self.assertEqual( - sorted(headers.keys()), ["connection", "content-length", "content-type", "date", "server"] + sorted(headers.keys()), + ["connection", "content-length", "content-type", "date", "server"], ) self.assertEqual(headers["content-type"], "text/plain") # connection has been closed @@ -479,7 +482,7 @@ class EchoTests(object): class PipeliningTests(object): def setUp(self): - from waitress.tests.fixtureapps import echo + from tests.fixtureapps import echo self.start_subprocess(echo.app_body_only) @@ -521,7 +524,7 @@ class PipeliningTests(object): class ExpectContinueTests(object): def setUp(self): - from waitress.tests.fixtureapps import echo + from tests.fixtureapps import echo self.start_subprocess(echo.app_body_only) @@ -560,7 +563,7 @@ class ExpectContinueTests(object): class BadContentLengthTests(object): def setUp(self): - from waitress.tests.fixtureapps import badcl + from tests.fixtureapps import badcl self.start_subprocess(badcl.app) @@ -626,7 +629,7 @@ class BadContentLengthTests(object): class NoContentLengthTests(object): def setUp(self): - from waitress.tests.fixtureapps import nocl + from tests.fixtureapps import nocl self.start_subprocess(nocl.app) @@ -763,7 +766,7 @@ class NoContentLengthTests(object): class WriteCallbackTests(object): def setUp(self): - from waitress.tests.fixtureapps import writecb + from tests.fixtureapps import writecb self.start_subprocess(writecb.app) @@ -867,7 +870,7 @@ class TooLargeTests(object): toobig = 1050 def setUp(self): - from waitress.tests.fixtureapps import toolarge + from tests.fixtureapps import toolarge self.start_subprocess( toolarge.app, max_request_header_size=1000, max_request_body_size=1000 @@ -897,7 +900,9 @@ class TooLargeTests(object): def test_request_body_too_large_with_wrong_cl_http10_keepalive(self): body = "a" * self.toobig - to_send = "GET / HTTP/1.0\r\nContent-Length: 5\r\nConnection: Keep-Alive\r\n\r\n" + to_send = ( + "GET / HTTP/1.0\r\nContent-Length: 5\r\nConnection: Keep-Alive\r\n\r\n" + ) to_send += body to_send = tobytes(to_send) self.connect() @@ -1059,7 +1064,7 @@ class TooLargeTests(object): class InternalServerErrorTests(object): def setUp(self): - from waitress.tests.fixtureapps import error + from tests.fixtureapps import error self.start_subprocess(error.app, expose_tracebacks=True) @@ -1094,7 +1099,8 @@ class InternalServerErrorTests(object): self.assertEqual(cl, len(response_body)) self.assertTrue(response_body.startswith(b"Internal Server Error")) self.assertEqual( - sorted(headers.keys()), ["connection", "content-length", "content-type", "date", "server"] + sorted(headers.keys()), + ["connection", "content-length", "content-type", "date", "server"], ) # connection has been closed self.send_check_error(to_send) @@ -1153,7 +1159,8 @@ class InternalServerErrorTests(object): self.assertEqual(cl, len(response_body)) self.assertTrue(response_body.startswith(b"Internal Server Error")) self.assertEqual( - sorted(headers.keys()), ["connection", "content-length", "content-type", "date", "server"] + sorted(headers.keys()), + ["connection", "content-length", "content-type", "date", "server"], ) # connection has been closed self.send_check_error(to_send) @@ -1209,7 +1216,7 @@ class InternalServerErrorTests(object): class FileWrapperTests(object): def setUp(self): - from waitress.tests.fixtureapps import filewrapper + from tests.fixtureapps import filewrapper self.start_subprocess(filewrapper.app) diff --git a/waitress/tests/test_init.py b/tests/test_init.py index f9b91d7..f9b91d7 100644 --- a/waitress/tests/test_init.py +++ b/tests/test_init.py diff --git a/waitress/tests/test_parser.py b/tests/test_parser.py index 91837c7..91837c7 100644 --- a/waitress/tests/test_parser.py +++ b/tests/test_parser.py diff --git a/waitress/tests/test_proxy_headers.py b/tests/test_proxy_headers.py index 15b4a08..15b4a08 100644 --- a/waitress/tests/test_proxy_headers.py +++ b/tests/test_proxy_headers.py diff --git a/waitress/tests/test_receiver.py b/tests/test_receiver.py index b4910bb..b4910bb 100644 --- a/waitress/tests/test_receiver.py +++ b/tests/test_receiver.py diff --git a/waitress/tests/test_regression.py b/tests/test_regression.py index 3c4c6c2..3c4c6c2 100644 --- a/waitress/tests/test_regression.py +++ b/tests/test_regression.py diff --git a/waitress/tests/test_runner.py b/tests/test_runner.py index 127757e..e53018b 100644 --- a/waitress/tests/test_runner.py +++ b/tests/test_runner.py @@ -115,11 +115,11 @@ class Test_run(unittest.TestCase): def test_bad_app_object(self): self.match_output( - ["waitress.tests.fixtureapps.runner:a"], 1, "^Error: Bad object name 'a'" + ["tests.fixtureapps.runner:a"], 1, "^Error: Bad object name 'a'" ) def test_simple_call(self): - import waitress.tests.fixtureapps.runner as _apps + import tests.fixtureapps.runner as _apps def check_server(app, **kw): self.assertIs(app, _apps.app) @@ -128,12 +128,12 @@ class Test_run(unittest.TestCase): argv = [ "waitress-serve", "--port=80", - "waitress.tests.fixtureapps.runner:app", + "tests.fixtureapps.runner:app", ] self.assertEqual(runner.run(argv=argv, _serve=check_server), 0) def test_returned_app(self): - import waitress.tests.fixtureapps.runner as _apps + import tests.fixtureapps.runner as _apps def check_server(app, **kw): self.assertIs(app, _apps.app) @@ -143,7 +143,7 @@ class Test_run(unittest.TestCase): "waitress-serve", "--port=80", "--call", - "waitress.tests.fixtureapps.runner:returns_app", + "tests.fixtureapps.runner:returns_app", ] self.assertEqual(runner.run(argv=argv, _serve=check_server), 0) diff --git a/waitress/tests/test_server.py b/tests/test_server.py index 9134fb8..9134fb8 100644 --- a/waitress/tests/test_server.py +++ b/tests/test_server.py diff --git a/waitress/tests/test_task.py b/tests/test_task.py index 1a86245..1a86245 100644 --- a/waitress/tests/test_task.py +++ b/tests/test_task.py diff --git a/waitress/tests/test_trigger.py b/tests/test_trigger.py index af740f6..af740f6 100644 --- a/waitress/tests/test_trigger.py +++ b/tests/test_trigger.py diff --git a/waitress/tests/test_utilities.py b/tests/test_utilities.py index 15cd24f..15cd24f 100644 --- a/waitress/tests/test_utilities.py +++ b/tests/test_utilities.py diff --git a/waitress/tests/test_wasyncore.py b/tests/test_wasyncore.py index 9c23509..9c23509 100644 --- a/waitress/tests/test_wasyncore.py +++ b/tests/test_wasyncore.py @@ -1,56 +1,92 @@ [tox] envlist = - py27,py35,py36,py37,py38,pypy,pypy3, + lint, + py27,pypy, + py35,py36,py37,py38,pypy3, docs, - {py27,py35}-cover,coverage + coverage +isolated_build = True [testenv] commands = python --version - nosetests --with-xunit --xunit-file=nosetests-{envname}.xml {posargs:waitress} - + pytest {posargs:} extras = testing +setenv = + COVERAGE_FILE=.coverage.{envname} -[testenv:docs] -basepython = python3.5 -whitelist_externals = make +[testenv:coverage] +basepython = python3.8 commands = - make -C docs clean html epub BUILDDIR={envdir} "SPHINXOPTS=-W -E" -extras = - docs + coverage combine + coverage xml + coverage report --show-missing +deps = + coverage +setenv = + COVERAGE_FILE=.coverage +depends = py27, py35 -[py-cover] +[testenv:lint] +skip_install = True +basepython = python3.8 commands = - coverage run {envbindir}/nosetests waitress - coverage combine - coverage xml -o {envname}.xml + black --check --diff . + check-manifest + # flake8 src/waitress/ tests + # build sdist/wheel + python -m pep517.build . + twine check dist/* +deps = + black + readme_renderer + check-manifest + pep517 + twine + flake8 + flake8-bugbear +[testenv:docs] +whitelist_externals = + make +commands = + make -C docs html BUILDDIR={envdir} SPHINXOPTS="-W -E" extras = - testing + docs -[testenv:py27-cover] +[testenv:run-flake8] +skip_install = True +basepython = python3.8 commands = - {[py-cover]commands} - -setenv = - COVERAGE_FILE=.coverage.py2 + flake8 src/waitress/ tests +deps = + flake8 + flake8-bugbear -[testenv:py35-cover] +[testenv:run-black] +skip_install = True +basepython = python3.8 commands = - {[py-cover]commands} - -setenv = - COVERAGE_FILE=.coverage.py3 + black . +deps = + black -[testenv:coverage] -basepython = python3.5 +[testenv:build] +skip_install = true +basepython = python3.8 commands = - coverage combine - coverage xml - coverage report --show-missing --fail-under=100 -deps = - coverage -setenv = - COVERAGE_FILE=.coverage + # clean up build/ and dist/ folders + python -c 'import shutil; shutil.rmtree("build", ignore_errors=True)' + # Make sure we aren't forgetting anything + check-manifest + # build sdist/wheel + python -m pep517.build . + # Verify all is well + twine check dist/* +deps = + readme_renderer + check-manifest + pep517 + twine |