Blob Blame History Raw
From bfe84e91cffaf0c001f2108dd547091dd4b01832 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tadej=20Jane=C5=BE?= <tadej.j@nez.si>
Date: Thu, 26 Aug 2021 12:14:19 +0200
Subject: [PATCH 09/15] Replace obsolete @pytest.yield_fixture with
 @pytest.fixture

See https://docs.pytest.org/en/stable/yieldfixture.html.
---
 tests/conftest.py          | 14 +++++++-------
 tests/test_cp.py           |  2 +-
 tests/test_project.py      |  4 ++--
 tests/test_rmvirtualenv.py |  2 +-
 4 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/tests/conftest.py b/tests/conftest.py
index 1bdf9d3..6b49f60 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -9,7 +9,7 @@ from pew._utils import invoke_pew as invoke
 from utils import TemporaryDirectory
 
 
-@pytest.yield_fixture(scope='session')
+@pytest.fixture(scope='session')
 def workon_home():
     tmpdir = os.environ.get('TMPDIR', gettempdir())
     os.environ['WORKON_HOME'] = str(Path(tmpdir) / 'WORKON_HOME')
@@ -21,7 +21,7 @@ def workon_home():
     rmtree(str(workon))
 
 
-@pytest.yield_fixture()
+@pytest.fixture()
 def workon_sym_home():
     # workon_home() fixture assumes it is the only one changing the environ
     # so save it and restore it after the test
@@ -49,27 +49,27 @@ def workon_sym_home():
     os.environ['WORKON_HOME'] = old_workon
 
 
-@pytest.yield_fixture()
+@pytest.fixture()
 def env1(workon_home):
     invoke('new', 'env1', '-d')
     yield
     invoke('rm', 'env1')
 
 
-@pytest.yield_fixture()
+@pytest.fixture()
 def env2(workon_home):
     invoke('new', 'env2', '-d')
     yield
     invoke('rm', 'env2')
 
-@pytest.yield_fixture()
+@pytest.fixture()
 def env_with_project(workon_home): # TODO: use for test_setproject/test_mkvirtualenv ?
     with TemporaryDirectory() as projectdir:
         invoke('new', 'env_with_project', '-d', '-a', projectdir)
         yield Path(projectdir)
         invoke('rm', 'env_with_project')
 
-@pytest.yield_fixture()
+@pytest.fixture()
 def testpackageenv(workon_home):
     testpackage = str(Path(__file__).parent / 'testpackage')
     invoke('new', 'source', '-d')
@@ -78,7 +78,7 @@ def testpackageenv(workon_home):
     invoke('rm', 'source')
 
 
-@pytest.yield_fixture()
+@pytest.fixture()
 def testtemplate(workon_home):
     sourcetemplate = Path(__file__).parent / 'template_test'
     testtemplatefile = workon_home / 'template_test'
diff --git a/tests/test_cp.py b/tests/test_cp.py
index 30517d1..e2f7653 100644
--- a/tests/test_cp.py
+++ b/tests/test_cp.py
@@ -15,7 +15,7 @@ pytestmark = skip_windows(
 )
 
 
-@pytest.yield_fixture()
+@pytest.fixture()
 def copied_env(workon_home, env1):
     invoke('cp', 'env1', 'destination', '-d')
     yield workon_home / 'destination'
diff --git a/tests/test_project.py b/tests/test_project.py
index 451eb15..49d8147 100644
--- a/tests/test_project.py
+++ b/tests/test_project.py
@@ -11,7 +11,7 @@ from pew._utils import temp_environ, invoke_pew as invoke
 from utils import skip_windows
 
 
-@pytest.yield_fixture(scope='session')
+@pytest.fixture(scope='session')
 def project_home():
     tmpdir = os.environ.get('TMPDIR', gettempdir())
     project = Path(tmpdir) / 'PROJECT_HOME'
@@ -23,7 +23,7 @@ def project_home():
     rmtree(str(project))
 
 
-@pytest.yield_fixture()
+@pytest.fixture()
 def project(workon_home, project_home):
     projname = 'project1'
     invoke('mkproject', projname, '-d')
diff --git a/tests/test_rmvirtualenv.py b/tests/test_rmvirtualenv.py
index 39eb697..abd43b3 100644
--- a/tests/test_rmvirtualenv.py
+++ b/tests/test_rmvirtualenv.py
@@ -5,7 +5,7 @@ import pytest
 from pew._utils import invoke_pew as invoke
 
 
-@pytest.yield_fixture()
+@pytest.fixture()
 def to_be_deleted(workon_home):
     envname = 'to_be_deleted'
     invoke('new', envname, '-d')
-- 
2.31.1