mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Add test
This commit is contained in:
parent
03c4b56c6e
commit
864a0b377d
@ -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)
|
Loading…
Reference in New Issue
Block a user