diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2021-07-07 02:09:50 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-07 02:09:50 +0900 |
commit | 5e5bca98f752cb61c36afc7955183e79a6095cf2 (patch) | |
tree | 66fc9448a4bbab736469fdad514dfa970787d495 /tests/test_quickstart.py | |
parent | 988a79de65737e403cd27721ce091760cf62b97f (diff) | |
parent | f0fef96906d80d89e290a780767a92ba85977733 (diff) | |
download | sphinx-git-5e5bca98f752cb61c36afc7955183e79a6095cf2.tar.gz |
Merge branch '4.x' into 6525_linkcheck_warn_redirects
Diffstat (limited to 'tests/test_quickstart.py')
-rw-r--r-- | tests/test_quickstart.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/test_quickstart.py b/tests/test_quickstart.py index 94144ef22..6c2f70ec4 100644 --- a/tests/test_quickstart.py +++ b/tests/test_quickstart.py @@ -10,6 +10,7 @@ import time from io import StringIO +from os import path import pytest @@ -250,3 +251,18 @@ def test_extensions(tempdir): ns = {} exec(conffile.read_text(), ns) assert ns['extensions'] == ['foo', 'bar', 'baz'] + + +def test_exits_when_existing_confpy(monkeypatch): + # The code detects existing conf.py with path.isfile() + # so we mock it as True with pytest's monkeypatch + def mock_isfile(path): + return True + monkeypatch.setattr(path, 'isfile', mock_isfile) + + qs.term_input = mock_input({ + 'Please enter a new root path (or just Enter to exit)': '' + }) + d = {} + with pytest.raises(SystemExit): + qs.ask_user(d) |