on master help sign in
Consolidate environment variable lists

We want to make sure that all of our test environments are clean from possible outside modification. This consolidates the list of used environment variables in Rust-based and Python-based integration tests. Note that there is also a similar list in `src/bin/bat/main.rs` which is even more exhaustive (for bug report collection). However, some of these variables can not possibly have an effect on test environments.

commit27f046ec036b6b3e0688048969db25ae4b0bfdd4 authorDavid Peter <mail@david-peter.de> dateMon 6 Sep 2021, 21:37 (5 years ago) parent74ae3de
2 files changed+15−7
tests/integration_tests.rs+8−4 tests/syntax-tests/create_highlighted_versions.py+7−3
tests/integration_tests.rs+8−4
@@ -34,13 +34,17 @@ const EXAMPLES_DIR: &str = "tests/examples";
3434fn bat_raw_command_with_config() -> Command {
3535 let mut cmd = Command::cargo_bin("bat").unwrap();
3636 cmd.current_dir("tests/examples");
37− cmd.env_remove("PAGER");
38− cmd.env_remove("BAT_PAGER");
37+ cmd.env_remove("BAT_CACHE_PATH");
38+ cmd.env_remove("BAT_CONFIG_DIR");
3939 cmd.env_remove("BAT_CONFIG_PATH");
40+ cmd.env_remove("BAT_OPTS");
41+ cmd.env_remove("BAT_PAGER");
4042 cmd.env_remove("BAT_STYLE");
41− cmd.env_remove("BAT_THEME");
4243 cmd.env_remove("BAT_TABS");
43− cmd.env_remove("BAT_CONFIG_DIR");
44+ cmd.env_remove("BAT_THEME");
45+ cmd.env_remove("COLORTERM");
46+ cmd.env_remove("NO_COLOR");
47+ cmd.env_remove("PAGER");
4448 cmd
4549}
4650
tests/syntax-tests/create_highlighted_versions.py+7−3
@@ -47,12 +47,16 @@ def create_highlighted_versions(output_basepath):
4747 ):
4848 try:
4949 env = os.environ.copy()
50− env.pop("PAGER", None)
51− env.pop("BAT_PAGER", None)
50+ env.pop("BAT_CACHE_PATH", None)
51+ env.pop("BAT_CONFIG_DIR", None)
5252 env.pop("BAT_CONFIG_PATH", None)
53+ env.pop("BAT_OPTS", None)
54+ env.pop("BAT_PAGER", None)
5355 env.pop("BAT_STYLE", None)
54− env.pop("BAT_THEME", None)
5556 env.pop("BAT_TABS", None)
57+ env.pop("BAT_THEME", None)
58+ env.pop("NO_COLOR", None)
59+ env.pop("PAGER", None)
5660 env["COLORTERM"] = "truecolor" # make sure to output 24bit colors
5761
5862 source_dirname = path.basename(path.dirname(source))