From 5878b9486acd7831c6c795453c7f2a9a138261c8 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Sun, 18 Dec 2022 20:16:02 +0800 Subject: [PATCH] pybind/mgr: s/setup(self)/setup_method(self)/ avoid pytest warnings like: 4: pg_autoscaler/tests/test_cal_final_pg_target.py::TestPgAutoscaler::test_even_pools_one_meta_three_bulk 4: /home/kefu/dev/ceph/src/pybind/mgr/.tox/py3/lib/python3.10/site-packages/_pytest/fixtures.py:900: PytestRemovedIn8Warning: Support for nose tests is deprecated and will be removed in a future release. 4: pg_autoscaler/tests/test_cal_final_pg_target.py::TestPgAutoscaler::test_even_pools_one_meta_three_bulk is using nose-specific method: `setup(self)` 4: To remove this warning, rename it to `setup_method(self)` 4: See docs: https://docs.pytest.org/en/stable/deprecations.html#support-for-tests-written-for-nose 4: fixture_result = next(generator) Signed-off-by: Kefu Chai --- .../mgr/pg_autoscaler/tests/test_cal_final_pg_target.py | 2 +- src/pybind/mgr/pg_autoscaler/tests/test_overlapping_roots.py | 2 +- src/pybind/mgr/progress/test_progress.py | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pybind/mgr/pg_autoscaler/tests/test_cal_final_pg_target.py b/src/pybind/mgr/pg_autoscaler/tests/test_cal_final_pg_target.py index d8ba83d111af4..655025bbef877 100644 --- a/src/pybind/mgr/pg_autoscaler/tests/test_cal_final_pg_target.py +++ b/src/pybind/mgr/pg_autoscaler/tests/test_cal_final_pg_target.py @@ -18,7 +18,7 @@ class RootMapItem: class TestPgAutoscaler(object): - def setup(self): + def setup_method(self): # a bunch of attributes for testing. self.autoscaler = module.PgAutoscaler('module_name', 0, 0) diff --git a/src/pybind/mgr/pg_autoscaler/tests/test_overlapping_roots.py b/src/pybind/mgr/pg_autoscaler/tests/test_overlapping_roots.py index bf4ddfb62020d..009019707ec84 100644 --- a/src/pybind/mgr/pg_autoscaler/tests/test_overlapping_roots.py +++ b/src/pybind/mgr/pg_autoscaler/tests/test_overlapping_roots.py @@ -42,7 +42,7 @@ class CRUSH: class TestPgAutoscaler(object): - def setup(self): + def setup_method(self): # a bunch of attributes for testing. self.autoscaler = module.PgAutoscaler('module_name', 0, 0) diff --git a/src/pybind/mgr/progress/test_progress.py b/src/pybind/mgr/progress/test_progress.py index ef4e7e1661805..47baa177e25b7 100644 --- a/src/pybind/mgr/progress/test_progress.py +++ b/src/pybind/mgr/progress/test_progress.py @@ -13,7 +13,7 @@ from progress import module class TestPgRecoveryEvent(object): # Testing PgRecoveryEvent class - def setup(self): + def setup_method(self): # Creating the class and Mocking # a bunch of attributes for testing module._module = mock.Mock() # just so Event._refresh() works @@ -90,7 +90,7 @@ class OSDMap: class TestModule(object): # Testing Module Class - def setup(self): + def setup_method(self): # Creating the class and Mocking a # bunch of attributes for testing -- 2.39.5