summaryrefslogtreecommitdiff
path: root/tests/test_quickstart.py
diff options
context:
space:
mode:
authorRaymond Sun <raymondsun33@gmail.com>2021-06-11 23:06:03 +1000
committerRaymond Sun <raymondsun33@gmail.com>2021-06-11 23:06:03 +1000
commit864a0b377d3ef6526837dfb721c260587ccb64f9 (patch)
tree6c6bd94f19fd9d819b5bde6d647ecdc84a9b40b8 /tests/test_quickstart.py
parent03c4b56c6e1be86c64d5ec3d0944dff9cd206c41 (diff)
downloadsphinx-git-864a0b377d3ef6526837dfb721c260587ccb64f9.tar.gz
Add test
Diffstat (limited to 'tests/test_quickstart.py')
-rw-r--r--tests/test_quickstart.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/tests/test_quickstart.py b/tests/test_quickstart.py
index 94144ef22..96b11daec 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
@@ -122,7 +123,6 @@ def test_quickstart_defaults(tempdir):
assert (tempdir / 'Makefile').isfile()
assert (tempdir / 'make.bat').isfile()
-
def test_quickstart_all_answers(tempdir):
answers = {
'Root path': tempdir,
@@ -250,3 +250,17 @@ def test_extensions(tempdir):
ns = {}
exec(conffile.read_text(), ns)
assert ns['extensions'] == ['foo', 'bar', 'baz']
+
+def test_easy_exit_when_existing_confpy(monkeypatch):
+ # The code detects existing conf.py with isfile() so we mock it
+ def mock_isfile(path):
+ return True
+ monkeypatch.setattr(path, 'isfile', mock_isfile)
+
+ answers = {
+ 'Please enter a new root path': '',
+ }
+ qs.term_input = mock_input(answers)
+ d = {}
+ with pytest.raises(SystemExit):
+ qs.ask_user(d) \ No newline at end of file