| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 196cfbe commit 100ab98
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -7,4 +7,5 @@ pre-commit | |||
| 7 | 7 | pytest | |
| 8 | 8 | pytest-cov | |
| 9 | 9 | pytest-instafail | |
| 10 | + pytest-subtests | ||
| 10 | 11 | pytest-sugar | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,12 +4,14 @@ | |||
| 4 | 4 | # This module is part of GitPython and is released under | |
| 5 | 5 | # the BSD License: https://opensource.org/license/bsd-3-clause/ | |
| 6 | 6 | ||
| 7 | + import ast | ||
| 7 | 8 | import contextlib | |
| 8 | 9 | from datetime import datetime | |
| 9 | 10 | import os | |
| 10 | 11 | import pathlib | |
| 11 | 12 | import pickle | |
| 12 | 13 | import stat | |
| 14 | + import subprocess | ||
| 13 | 15 | import sys | |
| 14 | 16 | import tempfile | |
| 15 | 17 | import time | |
@@ -502,3 +504,46 @@ def test_remove_password_from_command_line(self): | |||
| 502 | 504 | ||
| 503 | 505 | assert cmd_4 == remove_password_if_present(cmd_4) | |
| 504 | 506 | assert cmd_5 == remove_password_if_present(cmd_5) | |
| 507 | + | ||
| 508 | + @ddt.data("HIDE_WINDOWS_KNOWN_ERRORS", "HIDE_WINDOWS_FREEZE_ERRORS") | ||
| 509 | + def test_env_vars_for_windows_tests(self, name): | ||
| 510 | + def run_parse(value): | ||
| 511 | + command = [ | ||
| 512 | + sys.executable, | ||
| 513 | + "-c", | ||
| 514 | + f"from git.util import {name}; print(repr({name}))", | ||
| 515 | + ] | ||
| 516 | + output = subprocess.check_output( | ||
| 517 | + command, | ||
| 518 | + env=None if value is None else dict(os.environ, **{name: value}), | ||
| 519 | + text=True, | ||
| 520 | + ) | ||
| 521 | + return ast.literal_eval(output) | ||
| 522 | + | ||
| 523 | + assert_true_iff_win = self.assertTrue if os.name == "nt" else self.assertFalse | ||
| 524 | + | ||
| 525 | + truthy_cases = [ | ||
| 526 | + ("unset", None), | ||
| 527 | + ("true-seeming", "1"), | ||
| 528 | + ("true-seeming", "true"), | ||
| 529 | + ("true-seeming", "True"), | ||
| 530 | + ("true-seeming", "yes"), | ||
| 531 | + ("true-seeming", "YES"), | ||
| 532 | + ("false-seeming", "0"), | ||
| 533 | + ("false-seeming", "false"), | ||
| 534 | + ("false-seeming", "False"), | ||
| 535 | + ("false-seeming", "no"), | ||
| 536 | + ("false-seeming", "NO"), | ||
| 537 | + ("whitespace", " "), | ||
| 538 | + ] | ||
| 539 | + falsy_cases = [ | ||
| 540 | + ("empty", ""), | ||
| 541 | + ] | ||
| 542 | + | ||
| 543 | + for msg, env_var_value in truthy_cases: | ||
| 544 | + with self.subTest(msg, env_var_value=env_var_value): | ||
| 545 | + assert_true_iff_win(run_parse(env_var_value)) | ||
| 546 | + | ||
| 547 | + for msg, env_var_value in falsy_cases: | ||
| 548 | + with self.subTest(msg, env_var_value=env_var_value): | ||
| 549 | + self.assertFalse(run_parse(env_var_value)) | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments