# Path: mkdocs/exceptions.py
# class MkDocsException(ClickException):
# class Abort(MkDocsException):
# class ConfigurationError(MkDocsException):
# class BuildError(MkDocsException):
# class PluginError(BuildError):
#     def show(self, **kwargs):
# 
# Path: mkdocs/config/base.py
# class ValidationError(Exception):
# class Config(UserDict):
#     def __init__(self, schema, config_file_path=None):
#     def set_defaults(self):
#     def _validate(self):
#     def _pre_validate(self):
#     def _post_validate(self):
#     def validate(self):
#     def load_dict(self, patch):
#     def load_file(self, config_file):
# def _open_config_file(config_file):
# def load_config(config_file=None, **kwargs):
# 
# Path: mkdocs/config/defaults.py
# def get_schema():
# 
# Path: mkdocs/config/config_options.py
# class BaseConfigOption:
# 
#     def __init__(self):
#         self.warnings = []
#         self.default = None
# 
#     def is_required(self):
#         return False
# 
#     def validate(self, value):
#         return self.run_validation(value)
# 
#     def reset_warnings(self):
#         self.warnings = []
# 
#     def pre_validation(self, config, key_name):
#         """
#         Before all options are validated, perform a pre-validation process.
# 
#         The pre-validation process method should be implemented by subclasses.
#         """
# 
#     def run_validation(self, value):
#         """
#         Perform validation for a value.
# 
#         The run_validation method should be implemented by subclasses.
#         """
#         return value
# 
#     def post_validation(self, config, key_name):
#         """
#         After all options have passed validation, perform a post-validation
#         process to do any additional changes dependent on other config values.
# 
#         The post-validation process method should be implemented by subclasses.
#         """


import os
import tempfile
import unittest
from tempfile import TemporaryDirectory
from mkdocs import exceptions
from mkdocs.config import base, defaults
from mkdocs.config.config_options import BaseConfigOption
        class InvalidConfigOption(BaseConfigOption):
            def pre_validation(self, config, key_name):
                raise base.ValidationError('pre_validation error')

        c = base.Config(schema=(('invalid_option', InvalidConfigOption()), ))

        errors, warnings = c.validate()

        self.assertEqual(len(errors), 1)
        self.assertEqual(errors[0][0], 'invalid_option')
        self.assertEqual(str(errors[0][1]), 'pre_validation error')
        self.assertTrue(isinstance(errors[0][1], base.ValidationError))
        self.assertEqual(len(warnings), 0)

    def test_run_validation_error(self):
        class InvalidConfigOption(BaseConfigOption):
            def run_validation(self, value):
                raise base.ValidationError('run_validation error')

        c = base.Config(schema=(('invalid_option', InvalidConfigOption()), ))

        errors, warnings = c.validate()

        self.assertEqual(len(errors), 1)
        self.assertEqual(errors[0][0], 'invalid_option')
        self.assertEqual(str(errors[0][1]), 'run_validation error')
        self.assertTrue(isinstance(errors[0][1], base.ValidationError))
        self.assertEqual(len(warnings), 0)

    def test_post_validation_error(self):

# Path: mkdocs/exceptions.py
# class MkDocsException(ClickException):
# class Abort(MkDocsException):
# class ConfigurationError(MkDocsException):
# class BuildError(MkDocsException):
# class PluginError(BuildError):
#     def show(self, **kwargs):
# 
# Path: mkdocs/config/base.py
# class ValidationError(Exception):
# class Config(UserDict):
#     def __init__(self, schema, config_file_path=None):
#     def set_defaults(self):
#     def _validate(self):
#     def _pre_validate(self):
#     def _post_validate(self):
#     def validate(self):
#     def load_dict(self, patch):
#     def load_file(self, config_file):
# def _open_config_file(config_file):
# def load_config(config_file=None, **kwargs):
# 
# Path: mkdocs/config/defaults.py
# def get_schema():
# 
# Path: mkdocs/config/config_options.py
# class BaseConfigOption:
# 
#     def __init__(self):
#         self.warnings = []
#         self.default = None
# 
#     def is_required(self):
#         return False
# 
#     def validate(self, value):
#         return self.run_validation(value)
# 
#     def reset_warnings(self):
#         self.warnings = []
# 
#     def pre_validation(self, config, key_name):
#         """
#         Before all options are validated, perform a pre-validation process.
# 
#         The pre-validation process method should be implemented by subclasses.
#         """
# 
#     def run_validation(self, value):
#         """
#         Perform validation for a value.
# 
#         The run_validation method should be implemented by subclasses.
#         """
#         return value
# 
#     def post_validation(self, config, key_name):
#         """
#         After all options have passed validation, perform a post-validation
#         process to do any additional changes dependent on other config values.
# 
#         The post-validation process method should be implemented by subclasses.
#         """


# Path: mkdocs/tests/config/base_tests.py
import os
import tempfile
import unittest
from tempfile import TemporaryDirectory
from mkdocs import exceptions
from mkdocs.config import base, defaults
from mkdocs.config.config_options import BaseConfigOption

        class InvalidConfigOption(BaseConfigOption):
            def pre_validation(self, config, key_name):
                raise base.ValidationError('pre_validation error')

        c = base.Config(schema=(('invalid_option', InvalidConfigOption()), ))

        errors, warnings = c.validate()

        self.assertEqual(len(errors), 1)
        self.assertEqual(errors[0][0], 'invalid_option')
        self.assertEqual(str(errors[0][1]), 'pre_validation error')
        self.assertTrue(isinstance(errors[0][1], base.ValidationError))
        self.assertEqual(len(warnings), 0)

    def test_run_validation_error(self):
        class InvalidConfigOption(BaseConfigOption):
            def run_validation(self, value):
                raise base.ValidationError('run_validation error')

        c = base.Config(schema=(('invalid_option', InvalidConfigOption()), ))

        errors, warnings = c.validate()

        self.assertEqual(len(errors), 1)
        self.assertEqual(errors[0][0], 'invalid_option')
        self.assertEqual(str(errors[0][1]), 'run_validation error')
        self.assertTrue(isinstance(errors[0][1], base.ValidationError))
        self.assertEqual(len(warnings), 0)

    def test_post_validation_error(self):

        class InvalidConfigOption(BaseConfigOption):