예제 #1
0
        def go(check_call, exists):
            test_environ = {"PATH": os.pathsep.join(["/usr/bin", "/bin"])}
            executable = join("/bin", "vim")

            exists.side_effect = lambda fname: fname == executable
            util.open_in_editor("myfile", test_environ)
            check_call.assert_called_with([executable, "myfile"])
예제 #2
0
        def go(check_call, exists):
            test_environ = {"EDITOR": "myvim", "PATH": "/usr/bin"}
            executable = join("/usr/bin", "myvim")
            if not posix:
                executable += ".exe"

            exists.side_effect = lambda fname: fname == executable
            util.open_in_editor("myfile", test_environ)
            check_call.assert_called_with([executable, "myfile"])
예제 #3
0
        def go(check_call, exists):
            test_environ = {
                "PATH": os.pathsep.join(
                    [r"C:\Windows\System32", r"C:\Users\user\bin"]
                )
            }
            executable = join(r"C:\Users\user\bin", "notepad.exe")

            exists.side_effect = lambda fname: fname == executable
            util.open_in_editor("myfile", test_environ)
            check_call.assert_called_with([executable, "myfile"])
예제 #4
0
 def go(check_call, exists):
     test_environ = {
         "EDITOR": "myvim",
         "VISUAL": "myvisual",
         "PATH": "/usr/bin",
     }
     exes = ["myvim", "myvisual"]
     if with_path:
         exes = [join("/usr/bin", n) for n in exes]
     exists.side_effect = lambda fname: fname in exes
     util.open_in_editor("myfile", test_environ)
     check_call.assert_called_with([exes[0], "myfile"])
예제 #5
0
 def go(check_call, exists):
     test_environ = {}
     exists.return_value = False
     with expect_raises_message(util.CommandError, "EDITOR"):
         util.open_in_editor("myfile", test_environ)
예제 #6
0
 def go(check_call, exists):
     test_environ = {"EDITOR": "/foo/myvim", "PATH": "/usr/bin"}
     exists.side_effect = lambda fname: fname == "/usr/bin/foo/myvim"
     with expect_raises_message(util.CommandError, "EDITOR"):
         util.open_in_editor("myfile", test_environ)
예제 #7
0
 def go(check_call, exists):
     test_environ = {key: "myvim", "PATH": "/usr/bin"}
     exists.side_effect = lambda fname: fname == "myvim"
     util.open_in_editor("myfile", test_environ)
     check_call.assert_called_with(["myvim", "myfile"])