Exemplo n.º 1
0
    def test_file(self, subprocess_mock):
        """
        Tests opening a file
        """
        fs.open_file_browser(self.test_file)
        args, kwargs = subprocess_mock.call_args

        if sys.platform.startswith("linux"):
            self.assertEqual(args[0], ["xdg-open", os.path.dirname(self.test_file)])

        elif sys.platform == "darwin":
            self.assertEqual(args[0], ["open", "-R", self.test_file])

        elif sys.platform == "win32":
            self.assertEqual(args[0], ["explorer", "/select,", self.test_file])
Exemplo n.º 2
0
    def test_folder(self, subprocess_mock):
        """
        Tests opening a folder
        """
        fs.open_file_browser(self.test_folder)
        args, kwargs = subprocess_mock.call_args

        if sys.platform.startswith("linux"):
            self.assertEqual(args[0], ["xdg-open", self.test_folder])

        elif sys.platform == "darwin":
            self.assertEqual(args[0], ["open", self.test_folder])

        elif sys.platform == "win32":
            self.assertEqual(args[0], ["cmd.exe", "/C", "start", self.test_folder])
Exemplo n.º 3
0
    def test_file(self, subprocess_mock):
        """
        Tests opening a file
        """
        fs.open_file_browser(self.test_file)
        args, kwargs = subprocess_mock.call_args

        if is_linux():
            self.assertEqual(args[0], ["xdg-open", os.path.dirname(self.test_file)])

        elif is_macos():
            self.assertEqual(args[0], ["open", "-R", self.test_file])

        elif is_windows():
            self.assertEqual(args[0], ["explorer", "/select,", self.test_file])
Exemplo n.º 4
0
    def test_folder(self, subprocess_mock):
        """
        Tests opening a folder
        """
        fs.open_file_browser(self.test_folder)
        args, kwargs = subprocess_mock.call_args

        if is_linux():
            self.assertEqual(args[0], ["xdg-open", self.test_folder])

        elif is_macos():
            self.assertEqual(args[0], ["open", self.test_folder])

        elif is_windows():
            self.assertEqual(args[0], ["cmd.exe", "/C", "start", self.test_folder])
Exemplo n.º 5
0
    def test_folder(self, subprocess_mock):
        """
        Tests opening a folder
        """
        fs.open_file_browser(self.test_folder)
        args, kwargs = subprocess_mock.call_args

        if sys.platform.startswith("linux"):
            self.assertEqual(args[0], ["xdg-open", self.test_folder])

        elif sys.platform == "darwin":
            self.assertEqual(args[0], ["open", self.test_folder])

        elif sys.platform == "win32":
            self.assertEqual(args[0],
                             ["cmd.exe", "/C", "start", self.test_folder])
Exemplo n.º 6
0
    def test_file(self, subprocess_mock):
        """
        Tests opening a file
        """
        fs.open_file_browser(self.test_file)
        args, kwargs = subprocess_mock.call_args

        if sys.platform.startswith("linux"):
            self.assertEqual(
                args[0],
                ["xdg-open", os.path.dirname(self.test_file)])

        elif sys.platform == "darwin":
            self.assertEqual(args[0], ["open", "-R", self.test_file])

        elif sys.platform == "win32":
            self.assertEqual(args[0], ["explorer", "/select,", self.test_file])