Skip to content
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

Tests for yaml file regex #4587

Merged
merged 1 commit into from Aug 29, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 15 additions & 5 deletions readthedocs/config/tests/test_config.py
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