Skip to content

Commit 611746e

Browse files
committed
CI: check entry points
Fixes: fdd23e8
1 parent c3396b9 commit 611746e

File tree

5 files changed

+26
-2
lines changed

5 files changed

+26
-2
lines changed

.github/workflows/tox.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,5 @@ jobs:
2828
python -m pip install --upgrade pip
2929
python -m pip install tox
3030
- run: tox -e run-module
31+
- run: tox -e run-entrypoint
3132
- run: tox -e py

appveyor.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ environment:
77
PYTHON: "C:\\Python38-x64"
88
- TOXENV: pycodestyle
99
PYTHON: "C:\\Python38-x64"
10+
# Windows cannot even import the module when they unconditionally import, see below.
11+
#- TOXENV: run-module
12+
# PYTHON: "C:\\Python38-x64"
13+
#- TOXENV: run-entrypoint
14+
# PYTHON: "C:\\Python38-x64"
1015
# Windows is not ready for testing!!!
1116
# Python's fcntl, grp, pwd, os.geteuid(), and socket.AF_UNIX are all Unix-only.
1217
#- TOXENV: py35

pyproject.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,14 @@ testing = [
6262
"pytest-cov",
6363
]
6464

65+
[project.scripts]
66+
# duplicates "python -m gunicorn" handling in __main__.py
67+
gunicorn = "gunicorn.app.wsgiapp:run"
68+
69+
# note the quotes around "paste.server_runner" to escape the dot
70+
[project.entry-points."paste.server_runner"]
71+
main = "gunicorn.app.pasterapp:serve"
72+
6573
[tool.pytest.ini_options]
6674
# # can override these: python -m pytest --override-ini="addopts="
6775
norecursedirs = ["examples", "lib", "local", "src"]

requirements_dev.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
-r requirements_test.txt
22

3+
# setuptools v68.0 fails hard on invalid pyproject.toml
4+
# which a developer would want to know
5+
# otherwise, oldest known-working version is 61.2
6+
setuptools>=68.0
7+
38
sphinx
49
sphinx_rtd_theme

tox.ini

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = py{37,38,39,310,311,py3}, lint, docs-lint, pycodestyle, run-module
2+
envlist = py{37,38,39,310,311,py3}, lint, docs-lint, pycodestyle, run-entrypoint, run-module
33
skipsdist = false
44
; Can't set skipsdist and use_develop in tox v4 to true due to https://github.com/tox-dev/tox/issues/2730
55

@@ -9,8 +9,13 @@ commands = pytest --cov=gunicorn {posargs}
99
deps =
1010
-rrequirements_test.txt
1111

12+
[testenv:run-entrypoint]
13+
# entry point: console script (provided by setuptools from pyproject.toml)
14+
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 ")'
15+
1216
[testenv:run-module]
13-
commands = python3 -m gunicorn --version
17+
# runpy (provided by module.__main__)
18+
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 ")'
1419

1520
[testenv:lint]
1621
commands =

0 commit comments

Comments
 (0)