| 273 | ), |
| 274 | ) |
| 275 | def test_warnings(): |
| 276 | # type: () -> None |
| 277 | environ = dict( |
| 278 | PEX_IGNORE_ERRORS="true", |
| 279 | PEX_ALWAYS_CACHE="true", |
| 280 | PEX_FORCE_LOCAL="true", |
| 281 | PEX_UNZIP="true", |
| 282 | ) |
| 283 | with warnings.catch_warnings(record=True) as events: |
| 284 | pex_warnings.configure_warnings(Variables(environ={})) |
| 285 | env = Variables(environ=environ) |
| 286 | assert env.PEX_IGNORE_ERRORS is True |
| 287 | assert env.PEX_ALWAYS_CACHE is True |
| 288 | assert env.PEX_FORCE_LOCAL is True |
| 289 | assert env.PEX_UNZIP is True |
| 290 | |
| 291 | warning_by_message_first_sentence = { |
| 292 | str(event.message).split(". ")[0]: event.message for event in events |
| 293 | } |
| 294 | assert all( |
| 295 | isinstance(warning, PEXWarning) for warning in warning_by_message_first_sentence.values() |
| 296 | ) |
| 297 | assert tuple( |
| 298 | sorted( |
| 299 | "The `{}` env var is deprecated".format(env_var) |
| 300 | for env_var in ("PEX_ALWAYS_CACHE", "PEX_FORCE_LOCAL", "PEX_UNZIP") |
| 301 | ) |
| 302 | ) == tuple(sorted(warning_by_message_first_sentence)) |
| 303 | |
| 304 | |
| 305 | def test_empty_pex_path_issue_1936(): |