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

Function pex

tests/tools/commands/test_venv.py:46–82  ·  view source on GitHub ↗
(
    request,  # type: Any
    tmpdir,  # type: Tempdir
)

Source from the content-addressed store, hash-verified

44 ]
45)
46def pex(
47 request, # type: Any
48 tmpdir, # type: Tempdir
49):
50 # type: (...) -> Iterator[str]
51
52 pex_path = tmpdir.join("fabric.pex")
53
54 src_dir = tmpdir.join("src")
55 touch(os.path.join(src_dir, "user/__init__.py"))
56 touch(os.path.join(src_dir, "user/package/__init__.py"))
57
58 # Fabric dips into Invoke vendored code. It depends on "invoke<2.0,>=1.3", but in version
59 # 1.7.0, the vendored `decorator` module Fabric depends on inside Invoke no longer is
60 # importable under Python 2.7; so we pin low.
61 # Additionally, the paramiko transitive dependency conflicts on Invoke for paramiko >=4.
62 constraints = tmpdir.join("constraints.txt")
63 with open(constraints, "w") as fp:
64 print("Invoke==1.6.0", file=fp)
65 print("paramiko<4", file=fp)
66
67 run_pex_command(
68 args=[
69 "fabric=={}".format(FABRIC_VERSION),
70 "--constraints",
71 constraints,
72 "-c",
73 "fab",
74 "--sources-directory",
75 src_dir,
76 "-o",
77 pex_path,
78 "--include-tools",
79 ]
80 + request.param
81 ).assert_success()
82 yield os.path.realpath(pex_path)
83
84
85def make_env(**kwargs):

Callers

nothing calls this directly

Calls 4

touchFunction · 0.90
run_pex_commandFunction · 0.90
assert_successMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected