mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
refactor: test: Do not use deprecated function: execfile_()
This commit is contained in:
parent
30f8640bab
commit
9ced1e355a
@ -16,7 +16,6 @@ import pytest
|
|||||||
from sphinx import application
|
from sphinx import application
|
||||||
from sphinx.cmd import quickstart as qs
|
from sphinx.cmd import quickstart as qs
|
||||||
from sphinx.util.console import coloron, nocolor
|
from sphinx.util.console import coloron, nocolor
|
||||||
from sphinx.util.pycompat import execfile_
|
|
||||||
|
|
||||||
warnfile = StringIO()
|
warnfile = StringIO()
|
||||||
|
|
||||||
@ -108,7 +107,7 @@ def test_quickstart_defaults(tempdir):
|
|||||||
conffile = tempdir / 'conf.py'
|
conffile = tempdir / 'conf.py'
|
||||||
assert conffile.isfile()
|
assert conffile.isfile()
|
||||||
ns = {}
|
ns = {}
|
||||||
execfile_(conffile, ns)
|
exec(conffile.read_text(), ns)
|
||||||
assert ns['extensions'] == []
|
assert ns['extensions'] == []
|
||||||
assert ns['templates_path'] == ['_templates']
|
assert ns['templates_path'] == ['_templates']
|
||||||
assert ns['project'] == 'Sphinx Test'
|
assert ns['project'] == 'Sphinx Test'
|
||||||
@ -158,7 +157,7 @@ def test_quickstart_all_answers(tempdir):
|
|||||||
conffile = tempdir / 'source' / 'conf.py'
|
conffile = tempdir / 'source' / 'conf.py'
|
||||||
assert conffile.isfile()
|
assert conffile.isfile()
|
||||||
ns = {}
|
ns = {}
|
||||||
execfile_(conffile, ns)
|
exec(conffile.read_text(), ns)
|
||||||
assert ns['extensions'] == [
|
assert ns['extensions'] == [
|
||||||
'sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.todo'
|
'sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.todo'
|
||||||
]
|
]
|
||||||
@ -239,7 +238,7 @@ def test_default_filename(tempdir):
|
|||||||
conffile = tempdir / 'conf.py'
|
conffile = tempdir / 'conf.py'
|
||||||
assert conffile.isfile()
|
assert conffile.isfile()
|
||||||
ns = {}
|
ns = {}
|
||||||
execfile_(conffile, ns)
|
exec(conffile.read_text(), ns)
|
||||||
|
|
||||||
|
|
||||||
def test_extensions(tempdir):
|
def test_extensions(tempdir):
|
||||||
@ -249,5 +248,5 @@ def test_extensions(tempdir):
|
|||||||
conffile = tempdir / 'conf.py'
|
conffile = tempdir / 'conf.py'
|
||||||
assert conffile.isfile()
|
assert conffile.isfile()
|
||||||
ns = {}
|
ns = {}
|
||||||
execfile_(conffile, ns)
|
exec(conffile.read_text(), ns)
|
||||||
assert ns['extensions'] == ['foo', 'bar', 'baz']
|
assert ns['extensions'] == ['foo', 'bar', 'baz']
|
||||||
|
Loading…
Reference in New Issue
Block a user