Skip to content

Port https://github.com/rtfd/readthedocs-build/pull/38/ #4461

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 2 commits into from
Aug 27, 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
20 changes: 20 additions & 0 deletions readthedocs/config/tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,26 @@ def test_requirements_file_respects_configuration(tmpdir):
assert build.requirements_file == 'requirements.txt'


def test_requirements_file_is_null(tmpdir):
build = get_build_config(
{'requirements_file': None},
get_env_config(),
source_file=str(tmpdir.join('readthedocs.yml')),
)
build.validate()
assert build.requirements_file is None
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ups, forgot to rename this to the latest changes, I'll fix this in a couple of minutes



def test_requirements_file_is_blank(tmpdir):
build = get_build_config(
{'requirements_file': ''},
get_env_config(),
source_file=str(tmpdir.join('readthedocs.yml')),
)
build.validate()
assert build.requirements_file is None


def test_build_validate_calls_all_subvalidators(tmpdir):
apply_fs(tmpdir, minimal_config)
build = BuildConfigV1(
Expand Down
18 changes: 18 additions & 0 deletions readthedocs/config/tests/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,24 @@ def test_parse_single_config():
assert config[0]['base'] == 'path'


def test_parse_null_value():
buf = StringIO(u'base: null')
config = parse(buf)
assert config[0]['base'] is None


def test_parse_empty_value():
buf = StringIO(u'base:')
config = parse(buf)
assert config[0]['base'] is None


def test_parse_empty_string_value():
buf = StringIO(u'base: ""')
config = parse(buf)
assert config[0]['base'] == ''


def test_parse_empty_list():
buf = StringIO(u'base: []')
config = parse(buf)
Expand Down