Closed mgorny closed 2 years ago
Merging #2047 (b367e85) into master (0066cb1) will not change coverage. The diff coverage is
n/a
.
@@ Coverage Diff @@
## master #2047 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 63 63
Lines 6707 6707
Branches 1238 1238
=========================================
Hits 6707 6707
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 0066cb1...b367e85. Read the comment docs.
Heh I actually had this problem myself for
uWSGI
because I had that globally on my system, but it is unfortunately a harder task.
Yeah, I couldn't figure out how to make this work for uwsgi.
I'm thinking to myself though whether we shouldn't apply the same treatment for
uvicorn
for consistency too then?
Hmm, I did uvicorn in test_wsgi_servers
but I see it's also in test_asgi_servers
. I'll update the PR in a minute.
Covered asgi tests now too.
Well, I'm running a pretty big test environment here and gunicorn etc. just happen to be installed on the system. The goal's pretty much to try and see what could break on production systems — and I suppose people tend to run webservers there ;-).
Summary of Changes
Spawn the servers (gunicorn, uvicorn, etc.) during tests through sys.executable rather than directly, in order to ensure that the test server is run using the same Python executable as the test suite. Otherwise, the test servers are started using the Python executable specified in their shebang and can therefore escape the virtualenv they are being run in.
This is particularly problem for tests being run from Gentoo ebuilds. We create a --system-site-packages venv to install falcon in, in order to test whether it works correctly against the dependencies installed on the system prior to installing it. However, the installed packages such as gunicorn specify /usr/bin/python* shebangs that override the venv and therefore make these servers unable to find venv-installed falcon. Running them via sys.executable ensures that they are started through Python installed in the venv.
Related Issues
n/a
Pull Request Checklist
docs/
.docs/
.versionadded
,versionchanged
, ordeprecated
directives.docs/_newsfragments/
, with the file name format{issue_number}.{fragment_type}.rst
. (Runtowncrier --draft
to ensure it renders correctly.)