Skip to content

Commit

Permalink
refactor: test: Do not use deprecated function: execfile_()
Browse files Browse the repository at this point in the history
  • Loading branch information
tk0miya committed Jan 17, 2021
1 parent 30f8640 commit 9ced1e3
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions tests/test_quickstart.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
from sphinx import application
from sphinx.cmd import quickstart as qs
from sphinx.util.console import coloron, nocolor
from sphinx.util.pycompat import execfile_

warnfile = StringIO()

Expand Down Expand Up @@ -108,7 +107,7 @@ def test_quickstart_defaults(tempdir):
conffile = tempdir / 'conf.py'
assert conffile.isfile()
ns = {}
execfile_(conffile, ns)
exec(conffile.read_text(), ns)
assert ns['extensions'] == []
assert ns['templates_path'] == ['_templates']
assert ns['project'] == 'Sphinx Test'
Expand Down Expand Up @@ -158,7 +157,7 @@ def test_quickstart_all_answers(tempdir):
conffile = tempdir / 'source' / 'conf.py'
assert conffile.isfile()
ns = {}
execfile_(conffile, ns)
exec(conffile.read_text(), ns)
assert ns['extensions'] == [
'sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.todo'
]
Expand Down Expand Up @@ -239,7 +238,7 @@ def test_default_filename(tempdir):
conffile = tempdir / 'conf.py'
assert conffile.isfile()
ns = {}
execfile_(conffile, ns)
exec(conffile.read_text(), ns)


def test_extensions(tempdir):
Expand All @@ -249,5 +248,5 @@ def test_extensions(tempdir):
conffile = tempdir / 'conf.py'
assert conffile.isfile()
ns = {}
execfile_(conffile, ns)
exec(conffile.read_text(), ns)
assert ns['extensions'] == ['foo', 'bar', 'baz']

0 comments on commit 9ced1e3

Please sign in to comment.