MCPcopy
hub / github.com/pex-tool/pex / test_gevent_monkeypatch

Function test_gevent_monkeypatch

tests/integration/test_issue_2415.py:27–122  ·  view source on GitHub ↗
(tmpdir)

Source from the content-addressed store, hash-verified

25 ),
26)
27def test_gevent_monkeypatch(tmpdir):
28 # type: (Any) -> None
29
30 with safe_open(os.path.join(str(tmpdir), "app.py"), "w") as app_fp:
31 app_fp.write(
32 dedent(
33 """\
34 from flask import Flask
35
36
37 app = Flask(__name__)
38
39
40 @app.route("/<username>")
41 def hello_world(username):
42 return "Hello, {}!".format(username)
43 """
44 )
45 )
46
47 pex_root = os.path.join(str(tmpdir), "pex_root")
48 pex = os.path.join(str(tmpdir), "pex")
49
50 # N.B.: Created with the following, where gevent 1.3.4 was picked as a lower bound since it
51 # 1st introduced the `from gevent import monkey; monkey.patch_all()` ssl check warning that is
52 # the subject of issue 2415:
53 #
54 # pex3 lock create \
55 # --resolver-version pip-2020-resolver \
56 # --pip-version latest \
57 # --style universal \
58 # --interpreter-constraint ">=3.8,<3.13" \
59 # --no-build \
60 # --indent 2 \
61 # flask \
62 # "gevent>=1.3.4" \
63 # gunicorn[gevent]
64 lock = data.path("locks", "issue-2415.lock.json")
65
66 run_pex_command(
67 args=[
68 "--pex-root",
69 pex_root,
70 "--runtime-pex-root",
71 pex_root,
72 "--lock",
73 lock,
74 "-M",
75 "app",
76 "-c",
77 "gunicorn",
78 "--inject-args",
79 "--worker-class gevent app:app",
80 "-o",
81 pex,
82 ],
83 cwd=str(tmpdir),
84 ).assert_success()

Callers

nothing calls this directly

Calls 14

safe_openFunction · 0.90
run_pex_commandFunction · 0.90
safe_mkdirFunction · 0.90
URLFetcherClass · 0.90
assert_successMethod · 0.80
get_body_streamMethod · 0.80
stripMethod · 0.80
decodeMethod · 0.80
joinMethod · 0.45
writeMethod · 0.45
pathMethod · 0.45
registerMethod · 0.45

Tested by

no test coverage detected