Skip to content

Commit fefdea4

Browse files
stsewdagjohnson
authored andcommitted
1 parent ff0139d commit fefdea4

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

readthedocs/config/tests/test_config.py

+20
Original file line numberDiff line numberDiff line change
@@ -729,6 +729,26 @@ def test_requirements_file_respects_configuration(tmpdir):
729729
assert build.python.requirements == 'requirements.txt'
730730

731731

732+
def test_requirements_file_is_null(tmpdir):
733+
build = get_build_config(
734+
{'requirements_file': None},
735+
get_env_config(),
736+
source_file=str(tmpdir.join('readthedocs.yml')),
737+
)
738+
build.validate()
739+
assert build.requirements_file is None
740+
741+
742+
def test_requirements_file_is_blank(tmpdir):
743+
build = get_build_config(
744+
{'requirements_file': ''},
745+
get_env_config(),
746+
source_file=str(tmpdir.join('readthedocs.yml')),
747+
)
748+
build.validate()
749+
assert build.requirements_file is None
750+
751+
732752
def test_build_validate_calls_all_subvalidators(tmpdir):
733753
apply_fs(tmpdir, minimal_config)
734754
build = BuildConfigV1(

readthedocs/config/tests/test_parser.py

+18
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'] == ''
52+
53+
3654
def test_parse_empty_list():
3755
buf = StringIO(u'base: []')
3856
config = parse(buf)

0 commit comments

Comments
 (0)