示例#1
0
def test_factory_fails():
    config = BaseConfig()
    config.settings.update({"name": "Nothing"})
    with pytest.raises(NoCommitizenFoundException) as excinfo:
        factory.commiter_factory(config)

    assert "The committer has not been found in the system." in str(excinfo)
示例#2
0
    def __init__(self, config: BaseConfig, arguments: dict):
        if not git.is_git_project():
            raise NotAGitProjectError()

        self.config: BaseConfig = config
        self.arguments: dict = arguments
        self.bump_settings: dict = {
            **config.settings,
            **{
                key: arguments[key]
                for key in [
                    "tag_format",
                    "prerelease",
                    "increment",
                    "bump_message",
                    "annotated_tag",
                ] if arguments[key] is not None
            },
        }
        self.cz = factory.commiter_factory(self.config)
        self.changelog = arguments["changelog"] or self.config.settings.get(
            "update_changelog_on_bump")
        self.changelog_to_stdout = arguments["changelog_to_stdout"]
        self.no_verify = arguments["no_verify"]
        self.check_consistency = arguments["check_consistency"]
        self.retry = arguments["retry"]
示例#3
0
    def __init__(self, config: BaseConfig, args):
        if not git.is_git_project():
            raise NotAGitProjectError()

        self.config: BaseConfig = config
        self.cz = factory.commiter_factory(self.config)

        self.start_rev = args.get("start_rev") or self.config.settings.get(
            "changelog_start_rev"
        )
        self.file_name = args.get("file_name") or self.config.settings.get(
            "changelog_file"
        )
        self.incremental = args["incremental"] or self.config.settings.get(
            "changelog_incremental"
        )
        self.dry_run = args["dry_run"]
        self.unreleased_version = args["unreleased_version"]
        self.change_type_map = (
            self.config.settings.get("change_type_map") or self.cz.change_type_map
        )
        self.change_type_order = (
            self.config.settings.get("change_type_order") or self.cz.change_type_order
        )
        self.rev_range = args.get("rev_range")
        self.tag_format = args.get("tag_format") or self.config.settings.get(
            "tag_format"
        )
示例#4
0
    def __init__(self, config: BaseConfig, arguments: dict):
        if not git.is_git_project():
            raise NotAGitProjectError()

        self.config: BaseConfig = config
        self.cz = factory.commiter_factory(self.config)
        self.arguments = arguments
        self.temp_file: str = os.path.join(tempfile.gettempdir(), "cz.commit.backup")
示例#5
0
    def __init__(self, config: BaseConfig, args):
        self.config: BaseConfig = config
        self.cz = factory.commiter_factory(self.config)

        self.start_rev = args.get("start_rev")
        self.file_name = args.get("file_name") or self.config.settings.get(
            "changelog_file")
        self.incremental = args["incremental"]
        self.dry_run = args["dry_run"]
        self.unreleased_version = args["unreleased_version"]
示例#6
0
 def __init__(self, config: BaseConfig, arguments: dict):
     self.config: BaseConfig = config
     self.arguments: dict = arguments
     self.bump_settings: dict = {
         **config.settings,
         **{
             key: arguments[key]
             for key in [
                 "tag_format", "prerelease", "increment", "bump_message"
             ] if arguments[key] is not None
         },
     }
     self.cz = factory.commiter_factory(self.config)
示例#7
0
    def __init__(self, config: BaseConfig, arguments: Dict[str, str], cwd=os.getcwd()):
        """Initial check command.

        Args:
            config: The config object required for the command to perform its action
            arguments: All the flags provided by the user
            cwd: Current work directory
        """
        self.commit_msg_file: Optional[str] = arguments.get("commit_msg_file")
        self.rev_range: Optional[str] = arguments.get("rev_range")

        self._valid_command_argument()

        self.config: BaseConfig = config
        self.cz = factory.commiter_factory(self.config)
示例#8
0
 def __init__(self, config: BaseConfig, arguments: dict):
     self.config: BaseConfig = config
     self.arguments: dict = arguments
     self.bump_settings: dict = {
         **config.settings,
         **{
             key: arguments[key]
             for key in ["tag_format", "prerelease", "increment", "bump_message"]
             if arguments[key] is not None
         },
     }
     self.cz = factory.commiter_factory(self.config)
     self.changelog = arguments["changelog"]
     self.no_verify = arguments["no_verify"]
     self.check_consistency = arguments["check_consistency"]
示例#9
0
    def __init__(self, config: BaseConfig, arguments: dict, cwd=os.getcwd()):
        """Init method.

        Parameters
        ----------
        config : BaseConfig
            the config object required for the command to perform its action
        arguments : dict
            the arguments object that contains all
            the flags provided by the user

        """
        self.config: BaseConfig = config
        self.cz = factory.commiter_factory(self.config)
        self.arguments: dict = arguments
示例#10
0
 def __init__(self, config: dict, arguments: dict):
     self.config: dict = config
     self.arguments: dict = arguments
     self.parameters: dict = {
         **config,
         **{
             key: arguments[key]
             for key in [
                 "dry_run",
                 "tag_format",
                 "prerelease",
                 "increment",
                 "bump_message",
             ] if arguments[key] is not None
         },
     }
     self.cz = factory.commiter_factory(self.config)
示例#11
0
    def __init__(self, config: BaseConfig, arguments: Dict[str, str], cwd=os.getcwd()):
        """Init method.

        Parameters
        ----------
        config : BaseConfig
            the config object required for the command to perform its action
        arguments : dict
            the arguments object that contains all
            the flags provided by the user

        """
        self.commit_msg_file: Optional[str] = arguments.get("commit_msg_file")
        self.rev_range: Optional[str] = arguments.get("rev_range")

        self._valid_command_argument()

        self.config: BaseConfig = config
        self.cz = factory.commiter_factory(self.config)
示例#12
0
 def __init__(self, config: BaseConfig, *args):
     self.config: BaseConfig = config
     self.cz = factory.commiter_factory(self.config)
示例#13
0
 def __init__(self, config: dict, arguments: dict):
     self.config: dict = config
     self.cz = factory.commiter_factory(self.config)
     self.arguments = arguments
     self.temp_file: str = os.path.join(tempfile.gettempdir(),
                                        "cz.commit.backup")
示例#14
0
def test_factory():
    config = BaseConfig()
    config.settings.update({"name": defaults.DEFAULT_SETTINGS["name"]})
    r = factory.commiter_factory(config)
    assert isinstance(r, BaseCommitizen)
示例#15
0
def test_factory_fails():
    config = BaseConfig()
    config.settings.update({"name": "Nothing"})
    with pytest.raises(SystemExit):
        factory.commiter_factory(config)
示例#16
0
def test_factory_fails():
    config = {"name": "nothing"}
    with pytest.raises(SystemExit):
        factory.commiter_factory(config)
示例#17
0
def test_factory():
    config = {"name": defaults.name}
    r = factory.commiter_factory(config)
    assert isinstance(r, BaseCommitizen)
示例#18
0
 def __init__(self, config: dict, *args):
     self.config: dict = config
     self.cz = factory.commiter_factory(self.config)