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

Function test_patch

tests/test_variables.py:243–263  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

241
242
243def test_patch():
244 # type: () -> None
245 v = Variables(environ=dict(PEX_VERBOSE="3", PEX_PYTHON="jython", PEX_EMIT_WARNINGS="True"))
246 assert v.PEX_VERBOSE == 3
247 assert v.PEX_PYTHON == "jython"
248 assert v.PEX_EMIT_WARNINGS is True
249 assert v.PEX_FORCE_LOCAL is False
250
251 with v.patch(PEX_VERBOSE="1", PEX_EMIT_WARNINGS=None, PEX_FORCE_LOCAL="True") as env:
252 assert env["PEX_VERBOSE"] == "1"
253 assert env["PEX_PYTHON"] == "jython"
254 assert "PEX_EMIT_WARNINGS" not in env
255 assert env["PEX_FORCE_LOCAL"] == "True"
256
257 assert v.PEX_VERBOSE == 1
258 assert v.PEX_PYTHON == "jython"
259 assert v.PEX_EMIT_WARNINGS is None
260
261 # If the assertion is flipped from `is True` to `is False` this test fails; so MyPy is just
262 # confused here about the statement being unreachable.
263 assert v.PEX_FORCE_LOCAL is True # type: ignore[unreachable]
264
265
266@pytest.mark.skipif(

Callers

nothing calls this directly

Calls 2

patchMethod · 0.95
VariablesClass · 0.90

Tested by

no test coverage detected