mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
Merge pull request #3108 from pajod/patch-githubactions
restore, and from now on CI-test for entry point
This commit is contained in:
commit
f9e61b11c7
6
.github/workflows/lint.yml
vendored
6
.github/workflows/lint.yml
vendored
@ -2,6 +2,9 @@ name: lint
|
|||||||
on: [push, pull_request]
|
on: [push, pull_request]
|
||||||
permissions:
|
permissions:
|
||||||
contents: read # to fetch code (actions/checkout)
|
contents: read # to fetch code (actions/checkout)
|
||||||
|
env:
|
||||||
|
# note that some tools care only for the name, not the value
|
||||||
|
FORCE_COLOR: 1
|
||||||
jobs:
|
jobs:
|
||||||
lint:
|
lint:
|
||||||
name: tox-${{ matrix.toxenv }}
|
name: tox-${{ matrix.toxenv }}
|
||||||
@ -14,9 +17,10 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Using Python ${{ matrix.python-version }}
|
- name: Using Python ${{ matrix.python-version }}
|
||||||
uses: actions/setup-python@v4
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.python-version }}
|
python-version: ${{ matrix.python-version }}
|
||||||
|
cache: pip
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: |
|
run: |
|
||||||
python -m pip install --upgrade pip
|
python -m pip install --upgrade pip
|
||||||
|
|||||||
10
.github/workflows/tox.yml
vendored
10
.github/workflows/tox.yml
vendored
@ -2,6 +2,9 @@ name: tox
|
|||||||
on: [push, pull_request]
|
on: [push, pull_request]
|
||||||
permissions:
|
permissions:
|
||||||
contents: read # to fetch code (actions/checkout)
|
contents: read # to fetch code (actions/checkout)
|
||||||
|
env:
|
||||||
|
# note that some tools care only for the name, not the value
|
||||||
|
FORCE_COLOR: 1
|
||||||
jobs:
|
jobs:
|
||||||
tox:
|
tox:
|
||||||
name: ${{ matrix.os }} / ${{ matrix.python-version }}
|
name: ${{ matrix.os }} / ${{ matrix.python-version }}
|
||||||
@ -14,11 +17,16 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Using Python ${{ matrix.python-version }}
|
- name: Using Python ${{ matrix.python-version }}
|
||||||
uses: actions/setup-python@v4
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.python-version }}
|
python-version: ${{ matrix.python-version }}
|
||||||
|
cache: pip
|
||||||
|
cache-dependency-path: requirements_test.txt
|
||||||
|
check-latest: true
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: |
|
run: |
|
||||||
python -m pip install --upgrade pip
|
python -m pip install --upgrade pip
|
||||||
python -m pip install tox
|
python -m pip install tox
|
||||||
|
- run: tox -e run-module
|
||||||
|
- run: tox -e run-entrypoint
|
||||||
- run: tox -e py
|
- run: tox -e py
|
||||||
|
|||||||
@ -7,6 +7,11 @@ environment:
|
|||||||
PYTHON: "C:\\Python38-x64"
|
PYTHON: "C:\\Python38-x64"
|
||||||
- TOXENV: pycodestyle
|
- TOXENV: pycodestyle
|
||||||
PYTHON: "C:\\Python38-x64"
|
PYTHON: "C:\\Python38-x64"
|
||||||
|
# Windows cannot even import the module when they unconditionally import, see below.
|
||||||
|
#- TOXENV: run-module
|
||||||
|
# PYTHON: "C:\\Python38-x64"
|
||||||
|
#- TOXENV: run-entrypoint
|
||||||
|
# PYTHON: "C:\\Python38-x64"
|
||||||
# Windows is not ready for testing!!!
|
# Windows is not ready for testing!!!
|
||||||
# Python's fcntl, grp, pwd, os.geteuid(), and socket.AF_UNIX are all Unix-only.
|
# Python's fcntl, grp, pwd, os.geteuid(), and socket.AF_UNIX are all Unix-only.
|
||||||
#- TOXENV: py35
|
#- TOXENV: py35
|
||||||
|
|||||||
@ -4,4 +4,8 @@
|
|||||||
# See the NOTICE for more information.
|
# See the NOTICE for more information.
|
||||||
|
|
||||||
from gunicorn.app.wsgiapp import run
|
from gunicorn.app.wsgiapp import run
|
||||||
run()
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
# see config.py - argparse defaults to basename(argv[0]) == "__main__.py"
|
||||||
|
# todo: let runpy.run_module take care of argv[0] rewriting
|
||||||
|
run(prog="gunicorn")
|
||||||
|
|||||||
@ -58,13 +58,13 @@ class WSGIApplication(Application):
|
|||||||
return self.load_wsgiapp()
|
return self.load_wsgiapp()
|
||||||
|
|
||||||
|
|
||||||
def run():
|
def run(prog=None):
|
||||||
"""\
|
"""\
|
||||||
The ``gunicorn`` command line runner for launching Gunicorn with
|
The ``gunicorn`` command line runner for launching Gunicorn with
|
||||||
generic WSGI applications.
|
generic WSGI applications.
|
||||||
"""
|
"""
|
||||||
from gunicorn.app.wsgiapp import WSGIApplication
|
from gunicorn.app.wsgiapp import WSGIApplication
|
||||||
WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
|
WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]", prog=prog).run()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
@ -57,13 +57,21 @@ setproctitle = ["setproctitle"]
|
|||||||
testing = [
|
testing = [
|
||||||
"gevent",
|
"gevent",
|
||||||
"eventlet",
|
"eventlet",
|
||||||
"cryptography",
|
|
||||||
"coverage",
|
"coverage",
|
||||||
"pytest",
|
"pytest",
|
||||||
"pytest-cov",
|
"pytest-cov",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[project.scripts]
|
||||||
|
# duplicates "python -m gunicorn" handling in __main__.py
|
||||||
|
gunicorn = "gunicorn.app.wsgiapp:run"
|
||||||
|
|
||||||
|
# note the quotes around "paste.server_runner" to escape the dot
|
||||||
|
[project.entry-points."paste.server_runner"]
|
||||||
|
main = "gunicorn.app.pasterapp:serve"
|
||||||
|
|
||||||
[tool.pytest.ini_options]
|
[tool.pytest.ini_options]
|
||||||
|
# # can override these: python -m pytest --override-ini="addopts="
|
||||||
norecursedirs = ["examples", "lib", "local", "src"]
|
norecursedirs = ["examples", "lib", "local", "src"]
|
||||||
testpaths = ["tests/"]
|
testpaths = ["tests/"]
|
||||||
addopts = "--assert=plain --cov=gunicorn --cov-report=xml"
|
addopts = "--assert=plain --cov=gunicorn --cov-report=xml"
|
||||||
|
|||||||
@ -1,4 +1,9 @@
|
|||||||
-r requirements_test.txt
|
-r requirements_test.txt
|
||||||
|
|
||||||
|
# setuptools v68.0 fails hard on invalid pyproject.toml
|
||||||
|
# which a developer would want to know
|
||||||
|
# otherwise, oldest known-working version is 61.2
|
||||||
|
setuptools>=68.0
|
||||||
|
|
||||||
sphinx
|
sphinx
|
||||||
sphinx_rtd_theme
|
sphinx_rtd_theme
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
gevent
|
gevent
|
||||||
eventlet
|
eventlet
|
||||||
cryptography
|
|
||||||
coverage
|
coverage
|
||||||
pytest
|
pytest
|
||||||
pytest-cov
|
pytest-cov
|
||||||
|
|||||||
10
tox.ini
10
tox.ini
@ -1,5 +1,5 @@
|
|||||||
[tox]
|
[tox]
|
||||||
envlist = py{37,38,39,310,311,py3}, lint, docs-lint, pycodestyle
|
envlist = py{37,38,39,310,311,py3}, lint, docs-lint, pycodestyle, run-entrypoint, run-module
|
||||||
skipsdist = false
|
skipsdist = false
|
||||||
; Can't set skipsdist and use_develop in tox v4 to true due to https://github.com/tox-dev/tox/issues/2730
|
; Can't set skipsdist and use_develop in tox v4 to true due to https://github.com/tox-dev/tox/issues/2730
|
||||||
|
|
||||||
@ -9,6 +9,14 @@ commands = pytest --cov=gunicorn {posargs}
|
|||||||
deps =
|
deps =
|
||||||
-rrequirements_test.txt
|
-rrequirements_test.txt
|
||||||
|
|
||||||
|
[testenv:run-entrypoint]
|
||||||
|
# entry point: console script (provided by setuptools from pyproject.toml)
|
||||||
|
commands = python -c 'import subprocess; cmd_out = subprocess.check_output(["gunicorn", "--version"])[:79].decode("utf-8", errors="replace"); print(cmd_out); assert cmd_out.startswith("gunicorn ")'
|
||||||
|
|
||||||
|
[testenv:run-module]
|
||||||
|
# runpy (provided by module.__main__)
|
||||||
|
commands = python -c 'import sys,subprocess; cmd_out = subprocess.check_output([sys.executable, "-m", "gunicorn", "--version"])[:79].decode("utf-8", errors="replace"); print(cmd_out); assert cmd_out.startswith("gunicorn ")'
|
||||||
|
|
||||||
[testenv:lint]
|
[testenv:lint]
|
||||||
commands =
|
commands =
|
||||||
pylint -j0 \
|
pylint -j0 \
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user