Skip to content

Commit 03b4a93

Browse files
stsewdagjohnson
authored andcommitted
Tests (#4587)
1 parent 0821a66 commit 03b4a93

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

readthedocs/config/tests/test_config.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
from __future__ import division, print_function, unicode_literals
33

44
import os
5-
import textwrap
65
import re
6+
import textwrap
77

88
import pytest
99
from mock import DEFAULT, patch
@@ -13,8 +13,8 @@
1313
ALL, BuildConfigV1, BuildConfigV2, ConfigError,
1414
ConfigOptionNotSupportedError, InvalidConfig, ProjectConfig, load)
1515
from readthedocs.config.config import (
16-
CONFIG_NOT_SUPPORTED, NAME_INVALID, NAME_REQUIRED, PYTHON_INVALID,
17-
VERSION_INVALID, CONFIG_FILENAME_REGEX)
16+
CONFIG_FILENAME_REGEX, CONFIG_NOT_SUPPORTED, CONFIG_REQUIRED, NAME_INVALID,
17+
NAME_REQUIRED, PYTHON_INVALID, VERSION_INVALID)
1818
from readthedocs.config.models import Conda
1919
from readthedocs.config.validation import (
2020
INVALID_BOOL, INVALID_CHOICE, INVALID_LIST, INVALID_PATH, INVALID_STRING)
@@ -81,10 +81,20 @@ def get_env_config(extra=None):
8181
return defaults
8282

8383

84-
def test_load_no_config_file(tmpdir):
84+
@pytest.mark.parametrize('files', [
85+
{},
86+
{'readthedocs.ymlmore': ''},
87+
{'startreadthedocs.yml': ''},
88+
{'noroot': {'readthedocs.ymlmore': ''}},
89+
{'noroot': {'startreadthedocs.yml': ''}},
90+
{'readthebots.yaml': ''},
91+
])
92+
def test_load_no_config_file(tmpdir, files):
93+
apply_fs(tmpdir, files)
8594
base = str(tmpdir)
86-
with raises(ConfigError):
95+
with raises(ConfigError) as e:
8796
load(base, env_config)
97+
assert e.value.code == CONFIG_REQUIRED
8898

8999

90100
def test_load_empty_config_file(tmpdir):

0 commit comments

Comments
 (0)