Example #1
0
File: test_sh.py Project: a-b/cider
    def test_rm(self, cask, debug, verbose, formulas):
        brew = Brew(cask, debug, verbose)
        args = self.__cmd(cask) + ["zap" if cask else "rm"] + formulas
        args += self.__flags(debug, verbose)

        brew.rm(*formulas)
        sh.spawn.assert_called_with(args, debug=debug, check_output=False,
                                    env=brew.env)
Example #2
0
File: test_sh.py Project: a-b/cider
    def test_ls(self, cask, debug, verbose):
        brew = Brew(cask, debug, verbose)
        old_return, sh.spawn.return_value = sh.spawn.return_value, ""
        args = self.__cmd(cask) + ["ls", "-1"]

        brew.ls()
        sh.spawn.assert_called_with(args, debug=debug, check_output=True,
                                    env=brew.env)
        sh.spawn.return_value = old_return
Example #3
0
File: test_sh.py Project: a-b/cider
    def test_untap(self, cask, debug, verbose, tap):
        with pytest.raises(AssertionError) if cask else empty():
            brew = Brew(cask, debug, verbose)
            args = self.__cmd() + ["untap", tap]
            args += self.__flags(debug, verbose)

            brew.untap(tap)
            sh.spawn.assert_called_with(args, debug=debug, check_output=False,
                                        env=brew.env)
Example #4
0
File: test_sh.py Project: a-b/cider
    def test_install(self, cask, debug, verbose, formulas, force):
        brew = Brew(cask, debug, verbose)
        args = self.__cmd(cask)
        args += ["install"] + formulas + (["--force"] if force else [])
        args += self.__flags(debug, verbose)

        brew.install(*formulas, force=force)
        sh.spawn.assert_called_with(args, debug=debug, check_output=False,
                                    env=brew.env)
Example #5
0
    def test_rm(self, cask, debug, verbose, formulas):
        brew = Brew(cask, debug, verbose)
        args = self.__cmd(cask) + ["zap" if cask else "rm"] + formulas
        args += self.__flags(debug, verbose)

        brew.rm(*formulas)
        sh.spawn.assert_called_with(args,
                                    debug=debug,
                                    check_output=False,
                                    env=brew.env)
Example #6
0
    def test_untap(self, cask, debug, verbose, tap):
        with pytest.raises(AssertionError) if cask else empty():
            brew = Brew(cask, debug, verbose)
            args = self.__cmd() + ["untap", tap]
            args += self.__flags(debug, verbose)

            brew.untap(tap)
            sh.spawn.assert_called_with(args,
                                        debug=debug,
                                        check_output=False,
                                        env=brew.env)
Example #7
0
    def test_install(self, cask, debug, verbose, formulas, force):
        brew = Brew(cask, debug, verbose)
        args = self.__cmd(cask)
        args += ["install"] + formulas + (["--force"] if force else [])
        args += self.__flags(debug, verbose)

        brew.install(*formulas, force=force)
        sh.spawn.assert_called_with(args,
                                    debug=debug,
                                    check_output=False,
                                    env=brew.env)
Example #8
0
    def test_ls(self, cask, debug, verbose):
        brew = Brew(cask, debug, verbose)
        old_return, sh.spawn.return_value = sh.spawn.return_value, ""
        args = self.__cmd(cask) + ["ls", "-1"]

        brew.ls()
        sh.spawn.assert_called_with(args,
                                    debug=debug,
                                    check_output=True,
                                    env=brew.env)
        sh.spawn.return_value = old_return
Example #9
0
File: test_sh.py Project: a-b/cider
    def test_tap(self, cask, debug, verbose, tap, use_tap):
        with pytest.raises(AssertionError) if cask else empty():
            brew = Brew(cask, debug, verbose)
            tap = tap if use_tap else None
            args = self.__cmd() + ["tap"] + ([tap] if tap is not None else [])
            args += self.__flags(debug, verbose)

            brew.tap(tap)
            sh.spawn.assert_called_with(args, debug=debug,
                                        check_output=not use_tap,
                                        env=brew.env)
Example #10
0
File: test_sh.py Project: a-b/cider
    def test_uses(self, cask, debug, verbose, formula):
        brew = Brew(cask, debug, verbose)
        old_return, sh.spawn.return_value = sh.spawn.return_value, ""
        args = self.__cmd(cask)
        args += ["uses", "--installed", "--recursive", formula]
        args += self.__flags(debug, verbose)

        brew.uses(formula)
        sh.spawn.assert_called_with(args, debug=debug, check_output=True,
                                    env=brew.env)
        sh.spawn.return_value = old_return
Example #11
0
    def test_tap(self, cask, debug, verbose, tap, use_tap):
        with pytest.raises(AssertionError) if cask else empty():
            brew = Brew(cask, debug, verbose)
            tap = tap if use_tap else None
            args = self.__cmd() + ["tap"] + ([tap] if tap is not None else [])
            args += self.__flags(debug, verbose)

            brew.tap(tap)
            sh.spawn.assert_called_with(args,
                                        debug=debug,
                                        check_output=not use_tap,
                                        env=brew.env)
Example #12
0
File: test_sh.py Project: a-b/cider
    def test_safe_install(self, cask, debug, verbose, formula):
        brew = Brew(cask, debug, verbose)
        old_side_effect = sh.spawn.side_effect

        args = self.__cmd(cask) + ["install", formula]
        args += self.__flags(debug, verbose)
        sh.spawn.side_effect = CalledProcessError(42, " ".join(args))

        brew.safe_install(formula)
        sh.spawn.assert_called_with(args, debug=debug, check_output=False,
                                    env=brew.env)
        sh.spawn.side_effect = old_side_effect
Example #13
0
    def test_uses(self, cask, debug, verbose, formula):
        brew = Brew(cask, debug, verbose)
        old_return, sh.spawn.return_value = sh.spawn.return_value, ""
        args = self.__cmd(cask)
        args += ["uses", "--installed", "--recursive", formula]
        args += self.__flags(debug, verbose)

        brew.uses(formula)
        sh.spawn.assert_called_with(args,
                                    debug=debug,
                                    check_output=True,
                                    env=brew.env)
        sh.spawn.return_value = old_return
Example #14
0
    def test_safe_install(self, cask, debug, verbose, formula):
        brew = Brew(cask, debug, verbose)
        old_side_effect = sh.spawn.side_effect

        args = self.__cmd(cask) + ["install", formula]
        args += self.__flags(debug, verbose)
        sh.spawn.side_effect = CalledProcessError(42, " ".join(args))

        brew.safe_install(formula)
        sh.spawn.assert_called_with(args,
                                    debug=debug,
                                    check_output=False,
                                    env=brew.env)
        sh.spawn.side_effect = old_side_effect