Skip to content

Commit

Permalink
CI: check entry points
Browse files Browse the repository at this point in the history
Fixes: fdd23e8
  • Loading branch information
pajod committed Dec 7, 2023
1 parent c3396b9 commit 619d0af
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
4 changes: 4 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ environment:
PYTHON: "C:\\Python38-x64"
- TOXENV: pycodestyle
PYTHON: "C:\\Python38-x64"
- TOXENV: run-entrypoint
PYTHON: "C:\\Python38-x64"
- TOXENV: run-module
PYTHON: "C:\\Python38-x64"
# Windows is not ready for testing!!!
# Python's fcntl, grp, pwd, os.geteuid(), and socket.AF_UNIX are all Unix-only.
#- TOXENV: py35
Expand Down
8 changes: 8 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ testing = [
"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]
# # can override these: python -m pytest --override-ini="addopts="
norecursedirs = ["examples", "lib", "local", "src"]
Expand Down
9 changes: 7 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py{37,38,39,310,311,py3}, lint, docs-lint, pycodestyle, run-module
envlist = py{37,38,39,310,311,py3}, lint, docs-lint, pycodestyle, run-entrypoint, run-module
skipsdist = false
; Can't set skipsdist and use_develop in tox v4 to true due to https://github.com/tox-dev/tox/issues/2730

Expand All @@ -9,8 +9,13 @@ commands = pytest --cov=gunicorn {posargs}
deps =
-rrequirements_test.txt

[testenv:run-entrypoint]
# entry point: console scripts
commands = python3 -c 'import subprocess; assert subprocess.check_output(["gunicorn", "--version"]).decode().startswith("gunicorn ")'

[testenv:run-module]
commands = python3 -m gunicorn --version
# runpy: module.__main__
commands = python3 -c 'import sys,subprocess; assert subprocess.check_output([sys.executable, "-m", "gunicorn", "--version"]).decode().startswith("gunicorn ")'

[testenv:lint]
commands =
Expand Down

0 comments on commit 619d0af

Please sign in to comment.