diff --git a/common b/common index 5abc1d31f..9d653630c 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 5abc1d31f84c615dbfc060fd671efd85aade01f7 +Subproject commit 9d653630c7285f8f2ec2deb06cb473e4ad6e0700 diff --git a/readthedocs/config/config.py b/readthedocs/config/config.py index 0d949cba4..77d31ca92 100644 --- a/readthedocs/config/config.py +++ b/readthedocs/config/config.py @@ -31,7 +31,7 @@ __all__ = ( ) ALL = 'all' -CONFIG_FILENAME_REGEX = r'\.?readthedocs.ya?ml' +CONFIG_FILENAME_REGEX = r'^\.?readthedocs.ya?ml$' CONFIG_NOT_SUPPORTED = 'config-not-supported' VERSION_INVALID = 'version-invalid' diff --git a/readthedocs/config/tests/test_config.py b/readthedocs/config/tests/test_config.py index 9deb348df..3b502af44 100644 --- a/readthedocs/config/tests/test_config.py +++ b/readthedocs/config/tests/test_config.py @@ -2,8 +2,8 @@ from __future__ import division, print_function, unicode_literals import os -import textwrap import re +import textwrap import pytest from mock import DEFAULT, patch @@ -13,8 +13,8 @@ from readthedocs.config import ( ALL, BuildConfigV1, BuildConfigV2, ConfigError, ConfigOptionNotSupportedError, InvalidConfig, ProjectConfig, load) from readthedocs.config.config import ( - CONFIG_NOT_SUPPORTED, NAME_INVALID, NAME_REQUIRED, PYTHON_INVALID, - VERSION_INVALID, CONFIG_FILENAME_REGEX) + CONFIG_FILENAME_REGEX, CONFIG_NOT_SUPPORTED, CONFIG_REQUIRED, NAME_INVALID, + NAME_REQUIRED, PYTHON_INVALID, VERSION_INVALID) from readthedocs.config.models import Conda from readthedocs.config.validation import ( INVALID_BOOL, INVALID_CHOICE, INVALID_LIST, INVALID_PATH, INVALID_STRING) @@ -81,10 +81,20 @@ def get_env_config(extra=None): return defaults -def test_load_no_config_file(tmpdir): +@pytest.mark.parametrize('files', [ + {}, + {'readthedocs.ymlmore': ''}, + {'startreadthedocs.yml': ''}, + {'noroot': {'readthedocs.ymlmore': ''}}, + {'noroot': {'startreadthedocs.yml': ''}}, + {'readthebots.yaml': ''}, +]) +def test_load_no_config_file(tmpdir, files): + apply_fs(tmpdir, files) base = str(tmpdir) - with raises(ConfigError): + with raises(ConfigError) as e: load(base, env_config) + assert e.value.code == CONFIG_REQUIRED def test_load_empty_config_file(tmpdir):