def parse_args(self): self.parser = Transport(self.argv, options=self.options) self.parser.catch_help = self.help() self.parser.parse_args() self.path = util.infer_path(self.parser.unknown_commands) self.check_dependency() self.sign()
def parse_args(self, argv=None): """ pass argv during testing """ if argv is None: argv = self.argv options = [['--output', '-o']] parser = Transport(argv, options=options) parser.catch_help = self.help() parser.parse_args() self.source = util.infer_path(parser.unknown_commands) self.output = parser.get('--output', self.source + '-dvd.iso') self.check_dependency() self.make_iso() self.make_sha256sum()
def test_no_last_argument(self): args = ["gpg", "--output", "signed"] with raises(RuntimeError) as error: util.infer_path(args) assert "is not a valid path" in str(error.value)
def test_no_arguments(self): # the parser engine pops the current command so we can # certainly end up with an empty argv list result = util.infer_path([]) assert result.startswith("/")
def test_last_argument(self): args = ["gpg", "--output", "signed", "/"] result = util.infer_path(args) assert result == "/"