Skip to content

Add start and termination to YAML file regex #4584

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion common
2 changes: 1 addition & 1 deletion readthedocs/config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
)

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'
Expand Down
20 changes: 15 additions & 5 deletions readthedocs/config/tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -13,8 +13,8 @@
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)
Expand Down Expand Up @@ -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):
Expand Down