pytest: remove deprecated with_tempdir decorator

This commit is contained in:
shimizukawa 2017-01-06 00:26:01 +09:00
parent 380dd23d9f
commit d0a33dd785
6 changed files with 5 additions and 28 deletions

View File

@ -18,7 +18,7 @@ from textwrap import dedent
from sphinx.errors import SphinxError
import sphinx.builders.linkcheck
from util import with_app, with_tempdir, rootdir, tempdir, SkipTest, TestApp, path
from util import with_app, rootdir, tempdir, SkipTest, TestApp, path
try:
from docutils.writers.manpage import Writer as ManWriter
@ -77,7 +77,6 @@ def test_build_all():
yield verify_build, buildername, srcdir
@with_tempdir
def test_master_doc_not_found(tempdir):
(tempdir / 'conf.py').write_text('master_doc = "index"')
assert tempdir.listdir() == ['conf.py']

View File

@ -12,7 +12,7 @@
from six import PY3, iteritems
import mock
from util import TestApp, with_app, gen_with_app, with_tempdir, \
from util import TestApp, with_app, gen_with_app, \
raises, raises_msg, assert_in, assert_not_in
import sphinx
@ -86,7 +86,6 @@ def test_extension_values(app, status, warning):
'value_from_ext', 'x', True)
@with_tempdir
def test_errors_warnings(tempdir):
# test the error for syntax errors in the config file
(tempdir / 'conf.py').write_text(u'project = \n', encoding='ascii')
@ -117,7 +116,6 @@ def test_errors_warnings(tempdir):
assert warned[0]
@with_tempdir
def test_errors_if_setup_is_not_callable(tempdir):
# test the error to call setup() in the config file
(tempdir / 'conf.py').write_text(u'setup = 1')
@ -151,7 +149,6 @@ def test_needs_sphinx():
confoverrides={'needs_sphinx': '2'}) # NG: greater
@with_tempdir
def test_config_eol(tempdir):
# test config file's eol patterns: LF, CRLF
configfile = tempdir / 'conf.py'

View File

@ -23,7 +23,7 @@ from sphinx.ext.intersphinx import read_inventory, \
load_mappings, missing_reference, _strip_basic_auth, _read_from_url, \
_get_safe_url, fetch_inventory, INVENTORY_FILENAME
from util import with_app, with_tempdir
from util import with_app
inventory_v1 = '''\
@ -128,7 +128,6 @@ def test_fetch_inventory_redirection(_read_from_url, read_inventory, app, status
@with_app()
@with_tempdir
def test_missing_reference(tempdir, app, status, warning):
inv_file = tempdir / 'inventory'
inv_file.write_bytes(inventory_v2)
@ -219,7 +218,6 @@ def test_missing_reference(tempdir, app, status, warning):
@with_app()
@with_tempdir
def test_load_mappings_warnings(tempdir, app, status, warning):
"""
load_mappings issues a warning if new-style mapping

View File

@ -15,7 +15,7 @@ import time
from six import PY2, text_type, StringIO
from six.moves import input
from util import raises, with_tempdir, SkipTest
from util import raises, SkipTest
from sphinx import application
from sphinx import quickstart as qs
@ -125,7 +125,6 @@ def test_do_prompt_with_nonascii():
assert d['k1'] == u'\u30c9\u30a4\u30c4'
@with_tempdir
def test_quickstart_defaults(tempdir):
answers = {
'Root path': tempdir,
@ -163,7 +162,6 @@ def test_quickstart_defaults(tempdir):
assert (tempdir / 'make.bat').isfile()
@with_tempdir
def test_quickstart_all_answers(tempdir):
answers = {
'Root path': tempdir,
@ -231,7 +229,6 @@ def test_quickstart_all_answers(tempdir):
assert (tempdir / 'source' / 'contents.txt').isfile()
@with_tempdir
def test_generated_files_eol(tempdir):
answers = {
'Root path': tempdir,
@ -252,7 +249,6 @@ def test_generated_files_eol(tempdir):
assert_eol(tempdir / 'Makefile', '\n')
@with_tempdir
def test_quickstart_and_build(tempdir):
answers = {
'Root path': tempdir,
@ -278,7 +274,6 @@ def test_quickstart_and_build(tempdir):
assert not warnings
@with_tempdir
def test_default_filename(tempdir):
answers = {
'Root path': tempdir,
@ -300,7 +295,6 @@ def test_default_filename(tempdir):
assert ns['texinfo_documents'][0][1] == 'sphinx'
@with_tempdir
def test_extensions(tempdir):
qs.main(['sphinx-quickstart', '-q',
'-p', 'project_name', '-a', 'author',

View File

@ -12,7 +12,6 @@ from sphinx.util.fileutil import copy_asset, copy_asset_file
from sphinx.jinja2glue import BuiltinTemplateLoader
import mock
from util import with_tempdir
class DummyTemplateLoader(BuiltinTemplateLoader):
@ -24,7 +23,6 @@ class DummyTemplateLoader(BuiltinTemplateLoader):
self.init(builder)
@with_tempdir
def test_copy_asset_file(tempdir):
renderer = DummyTemplateLoader()
@ -68,7 +66,6 @@ def test_copy_asset_file(tempdir):
assert (subdir2 / 'asset.txt_t').text() == '# {{var1}} data'
@with_tempdir
def test_copy_asset(tempdir):
renderer = DummyTemplateLoader()

View File

@ -18,7 +18,7 @@ from babel.messages.mofile import read_mo
from sphinx.util import i18n
from sphinx.errors import SphinxError
from util import TestApp, with_tempdir, raises
from util import TestApp, raises
def test_catalog_info_for_file_and_path():
@ -37,7 +37,6 @@ def test_catalog_info_for_sub_domain_file_and_path():
assert cat.mo_path == path.join('path', 'sub/domain.mo')
@with_tempdir
def test_catalog_outdated(tempdir):
(tempdir / 'test.po').write_text('#')
cat = i18n.CatalogInfo(tempdir, 'test', 'utf-8')
@ -51,7 +50,6 @@ def test_catalog_outdated(tempdir):
assert cat.is_outdated() # if mo is exist and older than po
@with_tempdir
def test_catalog_write_mo(tempdir):
(tempdir / 'test.po').write_text('#')
cat = i18n.CatalogInfo(tempdir, 'test', 'utf-8')
@ -61,7 +59,6 @@ def test_catalog_write_mo(tempdir):
assert read_mo(f) is not None
@with_tempdir
def test_get_catalogs_for_xx(tempdir):
(tempdir / 'loc1' / 'xx' / 'LC_MESSAGES').makedirs()
(tempdir / 'loc1' / 'xx' / 'LC_MESSAGES' / 'test1.po').write_text('#')
@ -85,7 +82,6 @@ def test_get_catalogs_for_xx(tempdir):
])
@with_tempdir
def test_get_catalogs_for_en(tempdir):
(tempdir / 'loc1' / 'xx' / 'LC_MESSAGES').makedirs()
(tempdir / 'loc1' / 'xx' / 'LC_MESSAGES' / 'xx_dom.po').write_text('#')
@ -97,7 +93,6 @@ def test_get_catalogs_for_en(tempdir):
assert domains == set(['en_dom'])
@with_tempdir
def test_get_catalogs_with_non_existent_locale(tempdir):
catalogs = i18n.find_catalog_source_files([tempdir / 'loc1'], 'xx')
assert not catalogs
@ -111,7 +106,6 @@ def test_get_catalogs_with_non_existent_locale_dirs():
assert not catalogs
@with_tempdir
def test_get_catalogs_for_xx_without_outdated(tempdir):
(tempdir / 'loc1' / 'xx' / 'LC_MESSAGES').makedirs()
(tempdir / 'loc1' / 'xx' / 'LC_MESSAGES' / 'test1.po').write_text('#')
@ -139,7 +133,6 @@ def test_get_catalogs_for_xx_without_outdated(tempdir):
])
@with_tempdir
def test_get_catalogs_from_multiple_locale_dirs(tempdir):
(tempdir / 'loc1' / 'xx' / 'LC_MESSAGES').makedirs()
(tempdir / 'loc1' / 'xx' / 'LC_MESSAGES' / 'test1.po').write_text('#')
@ -152,7 +145,6 @@ def test_get_catalogs_from_multiple_locale_dirs(tempdir):
assert domains == ['test1', 'test1', 'test2']
@with_tempdir
def test_get_catalogs_with_compact(tempdir):
(tempdir / 'loc1' / 'xx' / 'LC_MESSAGES').makedirs()
(tempdir / 'loc1' / 'xx' / 'LC_MESSAGES' / 'test1.po').write_text('#')