summaryrefslogtreecommitdiffstats
path: root/test/test_config_command.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_config_command.py')
-rw-r--r--test/test_config_command.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/test/test_config_command.py b/test/test_config_command.py
index 5ff9e6f4e..f4220afcc 100644
--- a/test/test_config_command.py
+++ b/test/test_config_command.py
@@ -15,8 +15,9 @@ class ConfigCommandTest(unittest.TestCase, TestHelper):
def setUp(self):
self.lib = Library(":memory:")
self.temp_dir = mkdtemp()
- if "EDITOR" in os.environ:
- del os.environ["EDITOR"]
+ for k in ("VISUAL", "EDITOR"):
+ if k in os.environ:
+ del os.environ[k]
os.environ["BEETSDIR"] = self.temp_dir
self.config_path = os.path.join(self.temp_dir, "config.yaml")
@@ -90,12 +91,22 @@ class ConfigCommandTest(unittest.TestCase, TestHelper):
self.assertEqual(len(paths), 3)
self.assertEqual(paths[0], self.cli_config_path)
- def test_edit_config_with_editor_env(self):
+ def test_edit_config_with_visual_or_editor_env(self):
os.environ["EDITOR"] = "myeditor"
with patch("os.execlp") as execlp:
self.run_command("config", "-e")
execlp.assert_called_once_with("myeditor", "myeditor", self.config_path)
+ os.environ["VISUAL"] = "" # empty environment variables gets ignored
+ with patch("os.execlp") as execlp:
+ self.run_command("config", "-e")
+ execlp.assert_called_once_with("myeditor", "myeditor", self.config_path)
+
+ os.environ["VISUAL"] = "myvisual"
+ with patch("os.execlp") as execlp:
+ self.run_command("config", "-e")
+ execlp.assert_called_once_with("myvisual", "myvisual", self.config_path)
+
def test_edit_config_with_automatic_open(self):
with patch("beets.util.open_anything") as open:
open.return_value = "please_open"