replace yield fixtures

This commit is contained in:
Anthony Scopatz 2018-11-19 20:22:18 -05:00
parent a1e2c40688
commit b32823d236
9 changed files with 13 additions and 13 deletions

View file

@ -71,7 +71,7 @@ def monkeypatch_stderr(monkeypatch):
yield
@pytest.yield_fixture
@pytest.fixture
def xonsh_events():
yield events
for name, oldevent in vars(events).items():
@ -81,7 +81,7 @@ def xonsh_events():
setattr(events, name, newevent)
@pytest.yield_fixture
@pytest.fixture
def xonsh_builtins(xonsh_events):
"""Mock out most of the builtins xonsh attributes."""
old_builtins = set(dir(builtins))

View file

@ -37,7 +37,7 @@ pytestmark = pytest.mark.skipif(
)
@pytest.yield_fixture(scope="module")
@pytest.fixture(scope="module")
def shares_setup(tmpdir_factory):
"""create some shares to play with on current machine.
@ -218,8 +218,8 @@ def test_uncpushd_push_base_push_rempath(xonsh_builtins):
pass
# really? Need to cut-and-paste 2 flavors of this? yield_fixture requires yield in defined function body, not callee
@pytest.yield_fixture()
# really? Need to cut-and-paste 2 flavors of this? fixture requires yield in defined function body, not callee
@pytest.fixture()
def with_unc_check_enabled():
if not ON_WINDOWS:
return
@ -251,7 +251,7 @@ def with_unc_check_enabled():
winreg.CloseKey(key)
@pytest.yield_fixture()
@pytest.fixture()
def with_unc_check_disabled(): # just like the above, but value is 1 to *disable* unc check
if not ON_WINDOWS:
return

View file

@ -15,7 +15,7 @@ from xonsh.history.main import history_main, _xh_parse_args, construct_history
CMDS = ["ls", "cat hello kitty", "abc", "def", "touch me", "grep from me"]
@pytest.yield_fixture
@pytest.fixture
def hist():
h = JsonHistory(
filename="xonsh-HISTORY-TEST.json", here="yup", sessionid="SESSIONID", gc=False

View file

@ -10,7 +10,7 @@ from xonsh.history.main import history_main
import pytest
@pytest.yield_fixture
@pytest.fixture
def hist():
h = SqliteHistory(
filename="xonsh-HISTORY-TEST.sqlite", sessionid="SESSIONID", gc=False

View file

@ -13,7 +13,7 @@ from xonsh.built_ins import unload_builtins
imphooks.install_import_hooks()
@pytest.yield_fixture(autouse=True)
@pytest.fixture(autouse=True)
def imp_env():
execer = Execer(unload=False)
builtins.__xonsh__.env = Env({"PATH": [], "PATHEXT": []})

View file

@ -22,7 +22,7 @@ from xonsh.built_ins import load_builtins, unload_builtins
from xonsh.pyghooks import XonshLexer
@pytest.yield_fixture(autouse=True)
@pytest.fixture(autouse=True)
def load_command_cache():
load_builtins()
if ON_WINDOWS:

View file

@ -18,7 +18,7 @@ from tools import DummyEnv, skip_if_lt_ptk2
Context = namedtuple("Context", ["indent", "buffer", "accept", "cli", "cr"])
@pytest.yield_fixture(scope="module")
@pytest.fixture(scope="module")
def ctx():
"""Context in which the ptk multiline functionality will be tested."""
builtins.__xonsh__ = XonshSession()

View file

@ -15,7 +15,7 @@ from tools import skip_if_on_darwin
HISTDIR = os.path.join(os.path.dirname(__file__), "histories")
@pytest.yield_fixture(scope="module", autouse=True)
@pytest.fixture(scope="module", autouse=True)
def ctx():
"""Create a global Shell instance to use in all the test."""
ctx = {"PATH": []}

View file

@ -9,7 +9,7 @@ def test_load_xontrib_metadata():
xontrib_metadata()
@pytest.yield_fixture
@pytest.fixture
def tmpmod(tmpdir):
"""
Same as tmpdir but also adds/removes it to the front of sys.path.