|
2 | 2 | from __future__ import division, print_function, unicode_literals
|
3 | 3 |
|
4 | 4 | import os
|
5 |
| -import textwrap |
6 | 5 | import re
|
| 6 | +import textwrap |
7 | 7 |
|
8 | 8 | import pytest
|
9 | 9 | from mock import DEFAULT, patch
|
|
13 | 13 | ALL, BuildConfigV1, BuildConfigV2, ConfigError,
|
14 | 14 | ConfigOptionNotSupportedError, InvalidConfig, ProjectConfig, load)
|
15 | 15 | 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) |
18 | 18 | from readthedocs.config.models import Conda
|
19 | 19 | from readthedocs.config.validation import (
|
20 | 20 | INVALID_BOOL, INVALID_CHOICE, INVALID_LIST, INVALID_PATH, INVALID_STRING)
|
@@ -81,10 +81,20 @@ def get_env_config(extra=None):
|
81 | 81 | return defaults
|
82 | 82 |
|
83 | 83 |
|
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) |
85 | 94 | base = str(tmpdir)
|
86 |
| - with raises(ConfigError): |
| 95 | + with raises(ConfigError) as e: |
87 | 96 | load(base, env_config)
|
| 97 | + assert e.value.code == CONFIG_REQUIRED |
88 | 98 |
|
89 | 99 |
|
90 | 100 | def test_load_empty_config_file(tmpdir):
|
|
0 commit comments