# Path: mkdocs/__main__.py
# class ColorFormatter(logging.Formatter):
# class State:
#     def format(self, record):
#     def __init__(self, log_name='mkdocs', level=logging.INFO):
# def add_options(opts):
#     def inner(f):
# def verbose_option(f):
#     def callback(ctx, param, value):
# def quiet_option(f):
#     def callback(ctx, param, value):
# def cli():
# def serve_command(dev_addr, livereload, watch, **kwargs):
# def build_command(clean, **kwargs):
# def gh_deploy_command(clean, message, remote_branch, remote_name, force, ignore_version, shell, **kwargs):
# def new_command(project_directory):
# PYTHON_VERSION = f"{sys.version_info.major}.{sys.version_info.minor}"
# PKG_DIR = os.path.dirname(os.path.abspath(__file__))


import unittest
import logging
import io
from unittest import mock
from click.testing import CliRunner
from mkdocs import __main__ as cli
        self.assertTrue('dirty' in kwargs)
        self.assertTrue(kwargs['dirty'])

    @mock.patch('mkdocs.config.load_config', autospec=True)
    @mock.patch('mkdocs.commands.build.build', autospec=True)
    @mock.patch('mkdocs.commands.gh_deploy.gh_deploy', autospec=True)
    def test_gh_deploy_config_file(self, mock_gh_deploy, mock_build, mock_load_config):

        result = self.runner.invoke(
            cli.cli, ['gh-deploy', '--config-file', 'mkdocs.yml'], catch_exceptions=False)

        self.assertEqual(result.exit_code, 0)
        self.assertEqual(mock_gh_deploy.call_count, 1)
        self.assertEqual(mock_build.call_count, 1)
        self.assertEqual(mock_load_config.call_count, 1)
        args, kwargs = mock_load_config.call_args
        self.assertTrue('config_file' in kwargs)
        self.assertIsInstance(kwargs['config_file'], io.BufferedReader)
        self.assertEqual(kwargs['config_file'].name, 'mkdocs.yml')

    @mock.patch('mkdocs.config.load_config', autospec=True)
    @mock.patch('mkdocs.commands.build.build', autospec=True)
    @mock.patch('mkdocs.commands.gh_deploy.gh_deploy', autospec=True)
    def test_gh_deploy_message(self, mock_gh_deploy, mock_build, mock_load_config):

        result = self.runner.invoke(
            cli.cli, ['gh-deploy', '--message', 'A commit message'], catch_exceptions=False)

        self.assertEqual(result.exit_code, 0)
        self.assertEqual(mock_gh_deploy.call_count, 1)

# Path: mkdocs/__main__.py
# class ColorFormatter(logging.Formatter):
# class State:
#     def format(self, record):
#     def __init__(self, log_name='mkdocs', level=logging.INFO):
# def add_options(opts):
#     def inner(f):
# def verbose_option(f):
#     def callback(ctx, param, value):
# def quiet_option(f):
#     def callback(ctx, param, value):
# def cli():
# def serve_command(dev_addr, livereload, watch, **kwargs):
# def build_command(clean, **kwargs):
# def gh_deploy_command(clean, message, remote_branch, remote_name, force, ignore_version, shell, **kwargs):
# def new_command(project_directory):
# PYTHON_VERSION = f"{sys.version_info.major}.{sys.version_info.minor}"
# PKG_DIR = os.path.dirname(os.path.abspath(__file__))


# Path: mkdocs/tests/cli_tests.py
import unittest
import logging
import io
from unittest import mock
from click.testing import CliRunner
from mkdocs import __main__ as cli

        self.assertTrue('dirty' in kwargs)
        self.assertTrue(kwargs['dirty'])

    @mock.patch('mkdocs.config.load_config', autospec=True)
    @mock.patch('mkdocs.commands.build.build', autospec=True)
    @mock.patch('mkdocs.commands.gh_deploy.gh_deploy', autospec=True)
    def test_gh_deploy_config_file(self, mock_gh_deploy, mock_build, mock_load_config):

        result = self.runner.invoke(
            cli.cli, ['gh-deploy', '--config-file', 'mkdocs.yml'], catch_exceptions=False)

        self.assertEqual(result.exit_code, 0)
        self.assertEqual(mock_gh_deploy.call_count, 1)
        self.assertEqual(mock_build.call_count, 1)
        self.assertEqual(mock_load_config.call_count, 1)
        args, kwargs = mock_load_config.call_args
        self.assertTrue('config_file' in kwargs)
        self.assertIsInstance(kwargs['config_file'], io.BufferedReader)
        self.assertEqual(kwargs['config_file'].name, 'mkdocs.yml')

    @mock.patch('mkdocs.config.load_config', autospec=True)
    @mock.patch('mkdocs.commands.build.build', autospec=True)
    @mock.patch('mkdocs.commands.gh_deploy.gh_deploy', autospec=True)
    def test_gh_deploy_message(self, mock_gh_deploy, mock_build, mock_load_config):

        result = self.runner.invoke(
            cli.cli, ['gh-deploy', '--message', 'A commit message'], catch_exceptions=False)

        self.assertEqual(result.exit_code, 0)
        self.assertEqual(mock_gh_deploy.call_count, 1)

        g_args, g_kwargs = mock_gh_deploy.call_args