|
|
0d485a0 |
From bfe84e91cffaf0c001f2108dd547091dd4b01832 Mon Sep 17 00:00:00 2001
|
|
|
0d485a0 |
From: =?UTF-8?q?Tadej=20Jane=C5=BE?= <tadej.j@nez.si>
|
|
|
0d485a0 |
Date: Thu, 26 Aug 2021 12:14:19 +0200
|
|
|
0d485a0 |
Subject: [PATCH 09/15] Replace obsolete @pytest.yield_fixture with
|
|
|
0d485a0 |
@pytest.fixture
|
|
|
0d485a0 |
|
|
|
0d485a0 |
See https://docs.pytest.org/en/stable/yieldfixture.html.
|
|
|
0d485a0 |
---
|
|
|
0d485a0 |
tests/conftest.py | 14 +++++++-------
|
|
|
0d485a0 |
tests/test_cp.py | 2 +-
|
|
|
0d485a0 |
tests/test_project.py | 4 ++--
|
|
|
0d485a0 |
tests/test_rmvirtualenv.py | 2 +-
|
|
|
0d485a0 |
4 files changed, 11 insertions(+), 11 deletions(-)
|
|
|
0d485a0 |
|
|
|
0d485a0 |
diff --git a/tests/conftest.py b/tests/conftest.py
|
|
|
0d485a0 |
index 1bdf9d3..6b49f60 100644
|
|
|
0d485a0 |
--- a/tests/conftest.py
|
|
|
0d485a0 |
+++ b/tests/conftest.py
|
|
|
0d485a0 |
@@ -9,7 +9,7 @@ from pew._utils import invoke_pew as invoke
|
|
|
0d485a0 |
from utils import TemporaryDirectory
|
|
|
0d485a0 |
|
|
|
0d485a0 |
|
|
|
0d485a0 |
-@pytest.yield_fixture(scope='session')
|
|
|
0d485a0 |
+@pytest.fixture(scope='session')
|
|
|
0d485a0 |
def workon_home():
|
|
|
0d485a0 |
tmpdir = os.environ.get('TMPDIR', gettempdir())
|
|
|
0d485a0 |
os.environ['WORKON_HOME'] = str(Path(tmpdir) / 'WORKON_HOME')
|
|
|
0d485a0 |
@@ -21,7 +21,7 @@ def workon_home():
|
|
|
0d485a0 |
rmtree(str(workon))
|
|
|
0d485a0 |
|
|
|
0d485a0 |
|
|
|
0d485a0 |
-@pytest.yield_fixture()
|
|
|
0d485a0 |
+@pytest.fixture()
|
|
|
0d485a0 |
def workon_sym_home():
|
|
|
0d485a0 |
# workon_home() fixture assumes it is the only one changing the environ
|
|
|
0d485a0 |
# so save it and restore it after the test
|
|
|
0d485a0 |
@@ -49,27 +49,27 @@ def workon_sym_home():
|
|
|
0d485a0 |
os.environ['WORKON_HOME'] = old_workon
|
|
|
0d485a0 |
|
|
|
0d485a0 |
|
|
|
0d485a0 |
-@pytest.yield_fixture()
|
|
|
0d485a0 |
+@pytest.fixture()
|
|
|
0d485a0 |
def env1(workon_home):
|
|
|
0d485a0 |
invoke('new', 'env1', '-d')
|
|
|
0d485a0 |
yield
|
|
|
0d485a0 |
invoke('rm', 'env1')
|
|
|
0d485a0 |
|
|
|
0d485a0 |
|
|
|
0d485a0 |
-@pytest.yield_fixture()
|
|
|
0d485a0 |
+@pytest.fixture()
|
|
|
0d485a0 |
def env2(workon_home):
|
|
|
0d485a0 |
invoke('new', 'env2', '-d')
|
|
|
0d485a0 |
yield
|
|
|
0d485a0 |
invoke('rm', 'env2')
|
|
|
0d485a0 |
|
|
|
0d485a0 |
-@pytest.yield_fixture()
|
|
|
0d485a0 |
+@pytest.fixture()
|
|
|
0d485a0 |
def env_with_project(workon_home): # TODO: use for test_setproject/test_mkvirtualenv ?
|
|
|
0d485a0 |
with TemporaryDirectory() as projectdir:
|
|
|
0d485a0 |
invoke('new', 'env_with_project', '-d', '-a', projectdir)
|
|
|
0d485a0 |
yield Path(projectdir)
|
|
|
0d485a0 |
invoke('rm', 'env_with_project')
|
|
|
0d485a0 |
|
|
|
0d485a0 |
-@pytest.yield_fixture()
|
|
|
0d485a0 |
+@pytest.fixture()
|
|
|
0d485a0 |
def testpackageenv(workon_home):
|
|
|
0d485a0 |
testpackage = str(Path(__file__).parent / 'testpackage')
|
|
|
0d485a0 |
invoke('new', 'source', '-d')
|
|
|
0d485a0 |
@@ -78,7 +78,7 @@ def testpackageenv(workon_home):
|
|
|
0d485a0 |
invoke('rm', 'source')
|
|
|
0d485a0 |
|
|
|
0d485a0 |
|
|
|
0d485a0 |
-@pytest.yield_fixture()
|
|
|
0d485a0 |
+@pytest.fixture()
|
|
|
0d485a0 |
def testtemplate(workon_home):
|
|
|
0d485a0 |
sourcetemplate = Path(__file__).parent / 'template_test'
|
|
|
0d485a0 |
testtemplatefile = workon_home / 'template_test'
|
|
|
0d485a0 |
diff --git a/tests/test_cp.py b/tests/test_cp.py
|
|
|
0d485a0 |
index 30517d1..e2f7653 100644
|
|
|
0d485a0 |
--- a/tests/test_cp.py
|
|
|
0d485a0 |
+++ b/tests/test_cp.py
|
|
|
0d485a0 |
@@ -15,7 +15,7 @@ pytestmark = skip_windows(
|
|
|
0d485a0 |
)
|
|
|
0d485a0 |
|
|
|
0d485a0 |
|
|
|
0d485a0 |
-@pytest.yield_fixture()
|
|
|
0d485a0 |
+@pytest.fixture()
|
|
|
0d485a0 |
def copied_env(workon_home, env1):
|
|
|
0d485a0 |
invoke('cp', 'env1', 'destination', '-d')
|
|
|
0d485a0 |
yield workon_home / 'destination'
|
|
|
0d485a0 |
diff --git a/tests/test_project.py b/tests/test_project.py
|
|
|
0d485a0 |
index 451eb15..49d8147 100644
|
|
|
0d485a0 |
--- a/tests/test_project.py
|
|
|
0d485a0 |
+++ b/tests/test_project.py
|
|
|
0d485a0 |
@@ -11,7 +11,7 @@ from pew._utils import temp_environ, invoke_pew as invoke
|
|
|
0d485a0 |
from utils import skip_windows
|
|
|
0d485a0 |
|
|
|
0d485a0 |
|
|
|
0d485a0 |
-@pytest.yield_fixture(scope='session')
|
|
|
0d485a0 |
+@pytest.fixture(scope='session')
|
|
|
0d485a0 |
def project_home():
|
|
|
0d485a0 |
tmpdir = os.environ.get('TMPDIR', gettempdir())
|
|
|
0d485a0 |
project = Path(tmpdir) / 'PROJECT_HOME'
|
|
|
0d485a0 |
@@ -23,7 +23,7 @@ def project_home():
|
|
|
0d485a0 |
rmtree(str(project))
|
|
|
0d485a0 |
|
|
|
0d485a0 |
|
|
|
0d485a0 |
-@pytest.yield_fixture()
|
|
|
0d485a0 |
+@pytest.fixture()
|
|
|
0d485a0 |
def project(workon_home, project_home):
|
|
|
0d485a0 |
projname = 'project1'
|
|
|
0d485a0 |
invoke('mkproject', projname, '-d')
|
|
|
0d485a0 |
diff --git a/tests/test_rmvirtualenv.py b/tests/test_rmvirtualenv.py
|
|
|
0d485a0 |
index 39eb697..abd43b3 100644
|
|
|
0d485a0 |
--- a/tests/test_rmvirtualenv.py
|
|
|
0d485a0 |
+++ b/tests/test_rmvirtualenv.py
|
|
|
0d485a0 |
@@ -5,7 +5,7 @@ import pytest
|
|
|
0d485a0 |
from pew._utils import invoke_pew as invoke
|
|
|
0d485a0 |
|
|
|
0d485a0 |
|
|
|
0d485a0 |
-@pytest.yield_fixture()
|
|
|
0d485a0 |
+@pytest.fixture()
|
|
|
0d485a0 |
def to_be_deleted(workon_home):
|
|
|
0d485a0 |
envname = 'to_be_deleted'
|
|
|
0d485a0 |
invoke('new', envname, '-d')
|
|
|
0d485a0 |
--
|
|
|
0d485a0 |
2.31.1
|
|
|
0d485a0 |
|