Skip to content

Commit 92727f4

Browse files
committed
1 parent 5be4cd1 commit 92727f4

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

readthedocs/config/tests/test_config.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -737,6 +737,26 @@ def test_requirements_file_respects_configuration(tmpdir):
737737
assert build.requirements_file == 'requirements.txt'
738738

739739

740+
def test_requirements_file_is_null(tmpdir):
741+
build = get_build_config(
742+
{'requirements_file': None},
743+
get_env_config(),
744+
source_file=str(tmpdir.join('readthedocs.yml')),
745+
)
746+
build.validate()
747+
assert build.requirements_file is None
748+
749+
750+
def test_requirements_file_is_blank(tmpdir):
751+
build = get_build_config(
752+
{'requirements_file': ''},
753+
get_env_config(),
754+
source_file=str(tmpdir.join('readthedocs.yml')),
755+
)
756+
build.validate()
757+
assert build.requirements_file is None
758+
759+
740760
def test_build_validate_calls_all_subvalidators(tmpdir):
741761
apply_fs(tmpdir, minimal_config)
742762
build = BuildConfigV1(

readthedocs/config/tests/test_parser.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,24 @@ def test_parse_single_config():
3333
assert config[0]['base'] == 'path'
3434

3535

36+
def test_parse_null_value():
37+
buf = StringIO(u'base: null')
38+
config = parse(buf)
39+
assert config[0]['base'] is None
40+
41+
42+
def test_parse_empty_value():
43+
buf = StringIO(u'base:')
44+
config = parse(buf)
45+
assert config[0]['base'] is None
46+
47+
48+
def test_parse_empty_string_value():
49+
buf = StringIO(u'base: ""')
50+
config = parse(buf)
51+
assert config[0]['base'] is ''
52+
53+
3654
def test_parse_empty_list():
3755
buf = StringIO(u'base: []')
3856
config = parse(buf)

0 commit comments

Comments
 (0)