Skip to content

Commit

Permalink
WIP: CI 8
Browse files Browse the repository at this point in the history
  • Loading branch information
pajod committed Dec 27, 2023
1 parent 70612d4 commit b997961
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 20 deletions.
36 changes: 30 additions & 6 deletions .github/appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
version: '{branch}.{build}'
image: Visual Studio 2022
branches:
except:
- gh-pages
clone_depth: 1
environment:
matrix:
- TOXENV: lint
PYTHON: "C:\\Python38-x64"
- TOXENV: docs-lint
PYTHON: "C:\\Python38-x64"
- TOXENV: pycodestyle
PYTHON: "C:\\Python312-x64"
- TOXENV: pycodestyle
PYTHON: "C:\\Python38-x64"
- TOXENV: WSL
PYTHON: ''
# Windows cannot even import the module when they unconditionally import, see below.
#- TOXENV: run-module
# PYTHON: "C:\\Python38-x64"
Expand All @@ -28,18 +37,33 @@ environment:
# PYTHON: "C:\\Python39-x64"
matrix:
allow_failures:
- TOXENV: py35
- TOXENV: py36
- TOXENV: py37
- TOXENV: py38
- TOXENV: py39
init:
- SET "PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"
install:
- pip install tox
for:
- matrix:
except:
TOXENV: WSL
install:
- pip install tox
test_script:
- tox
- matrix:
only:
TOXENV: WSL
install:
- wsl pwd
- wsl whoami
- wsl cat /etc/os-release
- wsl sudo DEBIAN_FRONTEND=noninteractive apt-get update
- wsl sudo DEBIAN_FRONTEND=noninteractive apt-get install -y python3-venv python3-pip
- wsl python3 -m venv .
- wsl bin/pip install -U pip tox
test_script:
- wsl bin/tox
build: false
test_script:
- tox
cache:
# Not including the .tox directory since it takes longer to download/extract
# the cache archive than for tox to clean install from the pip cache.
Expand Down
4 changes: 2 additions & 2 deletions gunicorn/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2409,10 +2409,10 @@ class OnFatal(Setting):
desc = """\
Configure what to do if loading the application failes
If set to ``world-readable``, always send the traceback too the client.
If set to ``world-readable``, always send the traceback to the client.
The defaule behaviour ``guess`` is to share the traceback with the world
if the reloader is enabled. If set to ``refuse``, stop processing requests.
if --reload is in use. If set to ``refuse``, stop processing requests.
If set to ``quiet``, respond with error status but do not share internals.
The behaviour of ``world-readable`` (or, by extension ``guess``) risks exposing
Expand Down
6 changes: 3 additions & 3 deletions gunicorn/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ def get_dependency_version(package_name):
except Exception as ex:
print(ex, file=sys.stderr)
warnings.warn(
"gunicorn.packaging_support unavailale "
"- unmet dependencies will not produce nice tracebacks",
"unmet dependencies will not produce nice tracebacks - "
"gunicorn.packaging_support unavailale : %s" % ex,
RuntimeWarning,
)
return ""
return "0"


def load_entry_point(distribution, group, name):
Expand Down
2 changes: 1 addition & 1 deletion gunicorn/workers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def load_wsgi(self):
self.log.exception(e)
self.wsgi = util.make_fail_app("Internal Server Error")
return
elif self.cfg.on_fatal == "guess" and (self.cfg.reload or self.cfg.reload_extra_files):
elif self.cfg.on_fatal == "guess" and self.cfg.reload:
pass
else:
# secure fallthrough: "refuse"
Expand Down
8 changes: 5 additions & 3 deletions tests/test_e2e.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def run(self):
"--access-logfile=-",
"--disable-redirect-access-to-syslog",
"--graceful-timeout=%d" % GRACEFUL_TIMEOUT,
#"--on-fatal=quiet",
"--on-fatal=quiet",
# "--reload",
"--reload-extra=%s" % self.py_path,
"--bind=%s" % SERVER_BIND,
Expand Down Expand Up @@ -188,7 +188,7 @@ def run(self):
return conn.getresponse()


def test_process_request_after_syntax_error():
def test_process_request_after_fixing_syntax_error():
client = Client()

with TemporaryDirectory(suffix="_temp_py") as tempdir_name:
Expand All @@ -202,15 +202,17 @@ def test_process_request_after_syntax_error():

# raise RuntimeError(boot_log)

assert "SyntaxError: invalid syntax" in boot_log
assert "SyntaxError: invalid syntax" in boot_log, boot_log
assert ('%s.py", line ' % APP_BASENAME) in boot_log

# worker could not load, request will fail
response = client.run()
assert response.status == 500
assert response.reason == "Internal Server Error"
body = response.read(64 * 1024).decode("utf-8", "surrogateescape")
# --in-fatal=quiet responds, but does NOT share traceback
assert "error" in body.lower()
assert "load_wsgi" not in body.lower()

access_log = server._read_stdio(
key=OUT, wait_for_keyword='GET / HTTP/1.1" 500 ', timeout_sec=5,
Expand Down
10 changes: 5 additions & 5 deletions tests/test_e2e_debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ def run(self):
#"--access-logfile=-",
#"--disable-redirect-access-to-syslog",
"--graceful-timeout=%d" % GRACEFUL_TIMEOUT,
#"--on-fatal=guess",
"--reload",
# "--reload-extra=%s" % self.py_path,
"--on-fatal=world-readable",
# "--reload",
"--reload-extra=%s" % self.py_path,
"--bind=%s" % SERVER_BIND,
"--reuse-port",
"%s:app" % APP_BASENAME,
Expand Down Expand Up @@ -166,7 +166,7 @@ def run(self):
return conn.getresponse()


def test_process_request_after_syntax_error():
def test_process_shutdown_cleanly_after_inserting_syntax_error():
client = Client()

with TemporaryDirectory(suffix="_temp_py") as tempdir_name:
Expand Down Expand Up @@ -198,7 +198,7 @@ def test_process_request_after_syntax_error():
key=ERR, wait_for_keyword="reloading", timeout_sec=5
)
assert ("%s.py modified" % APP_BASENAME) in reload_log
assert "SyntaxError: invalid syntax" in reload_log
assert "SyntaxError: invalid syntax" in reload_log, reload_log
assert ('%s.py", line 3' % APP_BASENAME) in reload_log

# worker could not load, request will fail
Expand Down

0 comments on commit b997961

Please sign in to comment.