diff --git a/appveyor.yml b/appveyor.yml index 5eb48e9cd..5ea30b294 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -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 diff --git a/pyproject.toml b/pyproject.toml index ffe20515a..3ef076cc7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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"] diff --git a/tox.ini b/tox.ini index 83ce3374e..2859b5fcf 100644 --- a/tox.ini +++ b/tox.ini @@ -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 @@ -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 =