From: Zack Cerza Date: Fri, 20 Jan 2023 18:59:59 +0000 (-0700) Subject: tests: Rename setup() and teardown() methods X-Git-Tag: 1.2.0~133^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=87ca78084c77ed1ca03c5be37ada461c29034f41;p=teuthology.git tests: Rename setup() and teardown() methods These were nose methods, and pytest is dropping support for them. Signed-off-by: Zack Cerza --- diff --git a/teuthology/dispatcher/test/test_reimage_error_mark_machine_down.py b/teuthology/dispatcher/test/test_reimage_error_mark_machine_down.py index f2365174..63ec8ebb 100644 --- a/teuthology/dispatcher/test/test_reimage_error_mark_machine_down.py +++ b/teuthology/dispatcher/test/test_reimage_error_mark_machine_down.py @@ -2,7 +2,7 @@ from teuthology.dispatcher import supervisor from unittest.mock import patch class TestCheckReImageFailureMarkDown(object): - def setup(self): + def setup_method(self): self.the_function = supervisor.check_for_reimage_failures_and_mark_down def create_n_out_of_10_reimage_failed_jobs(self, n): diff --git a/teuthology/openstack/test/openstack-integration.py b/teuthology/openstack/test/openstack-integration.py index 41dde59b..c4eb7aaf 100644 --- a/teuthology/openstack/test/openstack-integration.py +++ b/teuthology/openstack/test/openstack-integration.py @@ -105,7 +105,7 @@ class Integration(object): class TestSuite(Integration): - def setup(self): + def setup_method(self): self.d = tempfile.mkdtemp() self.setup_worker() logging.info("TestSuite: done worker") @@ -152,7 +152,7 @@ class TestSuite(Integration): class TestSchedule(Integration): - def setup(self): + def setup_method(self): self.d = tempfile.mkdtemp() self.setup_worker() @@ -218,7 +218,7 @@ class TestSchedule(Integration): class TestLock(Integration): - def setup(self): + def setup_method(self): self.options = ['--verbose', '--machine-type', 'openstack' ] @@ -259,7 +259,7 @@ class TestLock(Integration): class TestNuke(Integration): - def setup(self): + def setup_method(self): self.options = ['--verbose', '--machine-type', 'openstack'] diff --git a/teuthology/openstack/test/test_config.py b/teuthology/openstack/test/test_config.py index 5fddeedf..530aea92 100644 --- a/teuthology/openstack/test/test_config.py +++ b/teuthology/openstack/test/test_config.py @@ -3,7 +3,7 @@ from teuthology.config import config class TestOpenStack(object): - def setup(self): + def setup_method(self): self.openstack_config = config['openstack'] def test_config_clone(self): diff --git a/teuthology/openstack/test/test_openstack.py b/teuthology/openstack/test/test_openstack.py index 7e5f4359..1f34d82a 100644 --- a/teuthology/openstack/test/test_openstack.py +++ b/teuthology/openstack/test/test_openstack.py @@ -40,7 +40,7 @@ import scripts.openstack class TestOpenStackBase(object): - def setup(self): + def setup_method(self): OpenStack.token = None OpenStack.token_expires = None self.environ = {} @@ -48,7 +48,7 @@ class TestOpenStackBase(object): if k.startswith('OS_'): self.environ[k] = os.environ[k] - def teardown(self): + def teardown_method(self): OpenStack.token = None OpenStack.token_expires = None for k in os.environ.keys(): @@ -1598,8 +1598,8 @@ class TestTeuthologyOpenStack(TestOpenStackBase): else: self.can_create_floating_ips = False - def setup(self): - super(TestTeuthologyOpenStack, self).setup() + def setup_method(self): + super(TestTeuthologyOpenStack, self).setup_method() self.key_filename = tempfile.mktemp() self.key_name = 'teuthology-test' self.name = 'teuthology-test' @@ -1614,8 +1614,8 @@ chmod 600 {key_filename} '--name', self.name, '--verbose'] - def teardown(self): - super(TestTeuthologyOpenStack, self).teardown() + def teardown_method(self): + super(TestTeuthologyOpenStack, self).teardown_method() self.clobber() os.unlink(self.key_filename) diff --git a/teuthology/orchestra/test/integration/test_integration.py b/teuthology/orchestra/test/integration/test_integration.py index f4ea627a..5adeb6dc 100644 --- a/teuthology/orchestra/test/integration/test_integration.py +++ b/teuthology/orchestra/test/integration/test_integration.py @@ -14,7 +14,7 @@ HOST = None class TestIntegration(): - def setup(self): + def setup_method(self): try: host = os.environ['ORCHESTRA_TEST_HOST'] except KeyError: diff --git a/teuthology/orchestra/test/test_cluster.py b/teuthology/orchestra/test/test_cluster.py index ee0d07a9..da9c8615 100644 --- a/teuthology/orchestra/test/test_cluster.py +++ b/teuthology/orchestra/test/test_cluster.py @@ -203,7 +203,7 @@ class TestCluster(object): class TestWriteFile(object): """ Tests for cluster.write_file """ - def setup(self): + def setup_method(self): self.r1 = remote.Remote('r1', ssh=Mock()) self.c = cluster.Cluster( remotes=[ diff --git a/teuthology/orchestra/test/test_connection.py b/teuthology/orchestra/test/test_connection.py index 487632de..c93a7332 100644 --- a/teuthology/orchestra/test/test_connection.py +++ b/teuthology/orchestra/test/test_connection.py @@ -6,10 +6,10 @@ from teuthology.orchestra.test.util import assert_raises class TestConnection(object): - def setup(self): + def setup_method(self): self.start_patchers() - def teardown(self): + def teardown_method(self): self.stop_patchers() def start_patchers(self): diff --git a/teuthology/orchestra/test/test_console.py b/teuthology/orchestra/test/test_console.py index 0338a577..fe0399b4 100644 --- a/teuthology/orchestra/test/test_console.py +++ b/teuthology/orchestra/test/test_console.py @@ -14,7 +14,7 @@ class TestPhysicalConsole(TestConsole): ipmi_cmd_templ = 'ipmitool -H {h}.{d} -I lanplus -U {u} -P {p} {c}' conserver_cmd_templ = 'console -M {m} -p {p} {mode} {h}' - def setup(self): + def setup_method(self): self.hostname = 'host' teuth_config.ipmi_domain = 'ipmi_domain' teuth_config.ipmi_user = 'ipmi_user' diff --git a/teuthology/orchestra/test/test_remote.py b/teuthology/orchestra/test/test_remote.py index 5fa5797e..2f2aec4b 100644 --- a/teuthology/orchestra/test/test_remote.py +++ b/teuthology/orchestra/test/test_remote.py @@ -9,10 +9,10 @@ from teuthology.orchestra.run import RemoteProcess class TestRemote(object): - def setup(self): + def setup_method(self): self.start_patchers() - def teardown(self): + def teardown_method(self): self.stop_patchers() def start_patchers(self): diff --git a/teuthology/orchestra/test/test_run.py b/teuthology/orchestra/test/test_run.py index 074d90b0..e8051ccb 100644 --- a/teuthology/orchestra/test/test_run.py +++ b/teuthology/orchestra/test/test_run.py @@ -28,10 +28,10 @@ def set_buffer_contents(buf, contents): class TestRun(object): - def setup(self): + def setup_method(self): self.start_patchers() - def teardown(self): + def teardown_method(self): self.stop_patchers() def start_patchers(self): diff --git a/teuthology/provision/cloud/test/test_base.py b/teuthology/provision/cloud/test/test_base.py index b1ef2990..67e83807 100644 --- a/teuthology/provision/cloud/test/test_base.py +++ b/teuthology/provision/cloud/test/test_base.py @@ -8,12 +8,12 @@ from test_cloud_init import dummy_config, dummy_drivers class TestBase(object): - def setup(self): + def setup_method(self): config.load() config.libcloud = dummy_config cloud.supported_drivers['dummy'] = dummy_drivers - def teardown(self): + def teardown_method(self): del cloud.supported_drivers['dummy'] diff --git a/teuthology/provision/cloud/test/test_cloud_init.py b/teuthology/provision/cloud/test/test_cloud_init.py index fdee723e..1b0df968 100644 --- a/teuthology/provision/cloud/test/test_cloud_init.py +++ b/teuthology/provision/cloud/test/test_cloud_init.py @@ -26,12 +26,12 @@ dummy_drivers = dict( class TestInit(object): - def setup(self): + def setup_method(self): config.load() config.libcloud = dummy_config cloud.supported_drivers['dummy'] = dummy_drivers - def teardown(self): + def teardown_method(self): del cloud.supported_drivers['dummy'] def test_get_types(self): diff --git a/teuthology/provision/cloud/test/test_cloud_util.py b/teuthology/provision/cloud/test/test_cloud_util.py index 2f6035a7..3093d2c4 100644 --- a/teuthology/provision/cloud/test/test_cloud_util.py +++ b/teuthology/provision/cloud/test/test_cloud_util.py @@ -82,7 +82,7 @@ def get_datetime_string(offset_hours=0): class TestAuthToken(object): klass = util.AuthToken - def setup(self): + def setup_method(self): default_expires = get_datetime_string(0) self.test_data = dict( value='token_value', @@ -103,7 +103,7 @@ class TestAuthToken(object): for name, patcher in self.patchers.items(): self.mocks[name] = patcher.start() - def teardown(self): + def teardown_method(self): for patcher in self.patchers.values(): patcher.stop() diff --git a/teuthology/provision/cloud/test/test_openstack.py b/teuthology/provision/cloud/test/test_openstack.py index 108532ed..f65bd41a 100644 --- a/teuthology/provision/cloud/test/test_openstack.py +++ b/teuthology/provision/cloud/test/test_openstack.py @@ -76,7 +76,7 @@ def get_fake_obj(mock_args=None, attributes=None): class TestOpenStackBase(object): - def setup(self): + def setup_method(self): config.load(dict(libcloud=deepcopy(test_config))) self.start_patchers() @@ -159,7 +159,7 @@ class TestOpenStackBase(object): self.mocks[name] = patcher.start() self.mocks['m_get_endpoint'].return_value = 'endpoint' - def teardown(self): + def teardown_method(self): for patcher in self.patchers.values(): patcher.stop() diff --git a/teuthology/provision/test/test_downburst.py b/teuthology/provision/test/test_downburst.py index cc947b28..71ecfaff 100644 --- a/teuthology/provision/test/test_downburst.py +++ b/teuthology/provision/test/test_downburst.py @@ -4,7 +4,7 @@ from teuthology import provision class TestDownburst(object): - def setup(self): + def setup_method(self): self.ctx = Mock() self.ctx.os_type = 'rhel' self.ctx.os_version = '7.0' diff --git a/teuthology/provision/test/test_fog.py b/teuthology/provision/test/test_fog.py index 0f56926d..fd2bbb5d 100644 --- a/teuthology/provision/test/test_fog.py +++ b/teuthology/provision/test/test_fog.py @@ -19,7 +19,7 @@ test_config = dict(fog=dict( class TestFOG(object): klass = fog.FOG - def setup(self): + def setup_method(self): config.load() config.update(deepcopy(test_config)) self.start_patchers() @@ -54,7 +54,7 @@ class TestFOG(object): for name, patcher in self.patchers.items(): self.mocks[name] = patcher.start() - def teardown(self): + def teardown_method(self): for patcher in self.patchers.values(): patcher.stop() diff --git a/teuthology/provision/test/test_init_provision.py b/teuthology/provision/test/test_init_provision.py index 11c67679..e63c5aa3 100644 --- a/teuthology/provision/test/test_init_provision.py +++ b/teuthology/provision/test/test_init_provision.py @@ -19,7 +19,7 @@ test_config = dict( class TestInitProvision(object): - def setup(self): + def setup_method(self): config.load(deepcopy(test_config)) def test_get_reimage_types(self): diff --git a/teuthology/provision/test/test_pelagos.py b/teuthology/provision/test/test_pelagos.py index 3a8a0c4f..43d47417 100644 --- a/teuthology/provision/test/test_pelagos.py +++ b/teuthology/provision/test/test_pelagos.py @@ -15,10 +15,10 @@ test_config = dict( class TestPelagos(object): - def setup(self): + def setup_method(self): config.load(deepcopy(test_config)) - def teardown(self): + def teardown_method(self): pass def test_get_types(self): diff --git a/teuthology/suite/test/test_build_matrix.py b/teuthology/suite/test/test_build_matrix.py index d7d2c051..ad710d2e 100644 --- a/teuthology/suite/test/test_build_matrix.py +++ b/teuthology/suite/test/test_build_matrix.py @@ -27,7 +27,7 @@ class TestBuildMatrix(object): 'builtins.open', ] - def setup(self): + def setup_method(self): self.mocks = dict() self.patchers = dict() for ppoint in self.__class__.patchpoints: @@ -45,7 +45,7 @@ class TestBuildMatrix(object): for patcher in self.patchers.values(): patcher.stop() - def teardown(self): + def teardown_method(self): self.patchers.clear() self.mocks.clear() @@ -673,7 +673,7 @@ class TestSubset(object): 'builtins.open', ] - def setup(self): + def setup_method(self): self.mocks = dict() self.patchers = dict() for ppoint in self.__class__.patchpoints: @@ -691,7 +691,7 @@ class TestSubset(object): for patcher in self.patchers.values(): patcher.stop() - def teardown(self): + def teardown_method(self): self.patchers.clear() self.mocks.clear() diff --git a/teuthology/suite/test/test_merge.py b/teuthology/suite/test/test_merge.py index 2a4c3bfa..3b6789b9 100644 --- a/teuthology/suite/test/test_merge.py +++ b/teuthology/suite/test/test_merge.py @@ -19,7 +19,7 @@ class TestMerge(TestCase): 'builtins.open', ] - def setUp(self): + def setup_method(self): log.debug("setUp") self.mocks = dict() self.patchers = dict() @@ -38,8 +38,7 @@ class TestMerge(TestCase): for patcher in self.patchers.values(): patcher.stop() - def tearDown(self): - log.debug("tearDown") + def teardown_method(self): self.patchers.clear() self.mocks.clear() diff --git a/teuthology/suite/test/test_run_.py b/teuthology/suite/test/test_run_.py index 278e1358..a580c360 100644 --- a/teuthology/suite/test/test_run_.py +++ b/teuthology/suite/test/test_run_.py @@ -23,7 +23,7 @@ from teuthology import packaging class TestRun(object): klass = run.Run - def setup(self): + def setup_method(self): self.args_dict = dict( suite='suite', suite_branch='suite_branch', @@ -203,7 +203,7 @@ class TestRun(object): class TestScheduleSuite(object): klass = run.Run - def setup(self): + def setup_method(self): self.args_dict = dict( suite='suite', suite_relpath='', diff --git a/teuthology/suite/test/test_util.py b/teuthology/suite/test/test_util.py index fdd352c4..2c4e8f4b 100644 --- a/teuthology/suite/test/test_util.py +++ b/teuthology/suite/test/test_util.py @@ -48,7 +48,7 @@ def git_repository(request): class TestUtil(object): - def setup(self): + def setup_method(self): config.use_shaman = False @patch('teuthology.suite.util.smtplib.SMTP') @@ -240,7 +240,7 @@ class TestMissingPackages(object): Tests the functionality that checks to see if a scheduled job will have missing packages in gitbuilder. """ - def setup(self): + def setup_method(self): package_versions = { 'sha1': { 'ubuntu': { @@ -340,7 +340,7 @@ class TestMissingPackages(object): class TestDistroDefaults(object): - def setup(self): + def setup_method(self): config.use_shaman = False def test_distro_defaults_saya(self): diff --git a/teuthology/task/tests/test_fetch_coredumps.py b/teuthology/task/tests/test_fetch_coredumps.py index 601a362c..2a9a7de0 100644 --- a/teuthology/task/tests/test_fetch_coredumps.py +++ b/teuthology/task/tests/test_fetch_coredumps.py @@ -19,7 +19,7 @@ class TestFetchCoreDumps(object): def communicate(self, input=None): return [TestFetchCoreDumps.MockDecode(self.ret)] - def setup(self): + def setup_method(self): self.the_function = fetch_binaries_for_coredumps with gzip.open('file.gz', 'wb') as f: f.write(b'Hello world!') diff --git a/teuthology/test/integration/test_suite.py b/teuthology/test/integration/test_suite.py index 04a4c122..a618c4cf 100644 --- a/teuthology/test/integration/test_suite.py +++ b/teuthology/test/integration/test_suite.py @@ -7,7 +7,7 @@ from teuthology import suite class TestSuiteOnline(object): - def setup(self): + def setup_method(self): if 'TEST_ONLINE' not in os.environ: skip("To run these sets, set the environment variable TEST_ONLINE") diff --git a/teuthology/test/task/__init__.py b/teuthology/test/task/__init__.py index 6fae57a8..d000cff8 100644 --- a/teuthology/test/task/__init__.py +++ b/teuthology/test/task/__init__.py @@ -11,7 +11,7 @@ class TestTask(object): klass = Task task_name = 'task' - def setup(self): + def setup_method(self): self.ctx = FakeNamespace() self.ctx.config = dict() self.task_config = dict() diff --git a/teuthology/test/task/test_ansible.py b/teuthology/test/task/test_ansible.py index bfef00d1..0c58f33b 100644 --- a/teuthology/test/task/test_ansible.py +++ b/teuthology/test/task/test_ansible.py @@ -23,10 +23,7 @@ class TestAnsibleTask(TestTask): klass = Ansible task_name = 'ansible' - def setup(self): - pass - - def setup_method(self, method): + def setup_method(self): self.ctx = FakeNamespace() self.ctx.cluster = Cluster() self.ctx.cluster.add(Remote('user@remote1'), ['role1']) @@ -505,8 +502,8 @@ class TestCephLabTask(TestAnsibleTask): klass = CephLab task_name = 'ansible.cephlab' - def setup(self): - super(TestCephLabTask, self).setup() + def setup_method(self): + super(TestCephLabTask, self).setup_method() self.task_config = dict() def start_patchers(self): diff --git a/teuthology/test/task/test_ceph_ansible.py b/teuthology/test/task/test_ceph_ansible.py index ff3b2ff6..29359c10 100644 --- a/teuthology/test/task/test_ceph_ansible.py +++ b/teuthology/test/task/test_ceph_ansible.py @@ -21,7 +21,7 @@ class TestCephAnsibleTask(TestTask): klass = CephAnsible task_name = 'ceph_ansible' - def setup(self): + def setup_method(self): self.ctx = FakeNamespace() self.ctx.cluster = Cluster() self.ctx.cluster.add(Remote('user@remote1'), ['mon.0']) diff --git a/teuthology/test/task/test_console_log.py b/teuthology/test/task/test_console_log.py index 132d5032..aeb88b43 100644 --- a/teuthology/test/task/test_console_log.py +++ b/teuthology/test/task/test_console_log.py @@ -15,7 +15,7 @@ class TestConsoleLog(TestTask): klass = ConsoleLog task_name = 'console_log' - def setup(self): + def setup_method(self): teuth_config.ipmi_domain = 'ipmi.domain' teuth_config.ipmi_user = 'ipmi_user' teuth_config.ipmi_password = 'ipmi_pass' @@ -45,7 +45,7 @@ class TestConsoleLog(TestTask): self.mocks[name] = patcher.start() self.mocks['is_vm'].return_value = False - def teardown(self): + def teardown_method(self): for patcher in self.patchers.values(): patcher.stop() diff --git a/teuthology/test/task/test_internal.py b/teuthology/test/task/test_internal.py index 4d125f50..1340b182 100644 --- a/teuthology/test/task/test_internal.py +++ b/teuthology/test/task/test_internal.py @@ -3,7 +3,7 @@ from teuthology.task import internal class TestInternal(object): - def setup(self): + def setup_method(self): self.ctx = FakeNamespace() self.ctx.config = dict() diff --git a/teuthology/test/task/test_kernel.py b/teuthology/test/task/test_kernel.py index 7be86587..593b204f 100644 --- a/teuthology/test/task/test_kernel.py +++ b/teuthology/test/task/test_kernel.py @@ -9,7 +9,7 @@ from teuthology.task.kernel import ( class TestKernelNormalizeAndApplyOverrides(object): - def setup(self): + def setup_method(self): self.ctx = FakeNamespace() self.ctx.cluster = Cluster() self.ctx.cluster.add(Remote('remote1'), ['mon.a', 'client.0']) diff --git a/teuthology/test/task/test_pcp.py b/teuthology/test/task/test_pcp.py index c70e5445..77774077 100644 --- a/teuthology/test/task/test_pcp.py +++ b/teuthology/test/task/test_pcp.py @@ -21,7 +21,7 @@ pcp_host = 'http://pcp.front.sepia.ceph.com:44323/' class TestPCPDataSource(object): klass = PCPDataSource - def setup(self): + def setup_method(self): config.pcp_host = pcp_host def test_init(self): @@ -231,7 +231,7 @@ class TestPCPTask(TestTask): klass = PCP task_name = 'pcp' - def setup(self): + def setup_method(self): self.ctx = FakeNamespace() self.ctx.cluster = Cluster() self.ctx.cluster.add(Remote('user@remote1'), ['role1']) diff --git a/teuthology/test/task/test_selinux.py b/teuthology/test/task/test_selinux.py index ddbff06d..68c8e9c0 100644 --- a/teuthology/test/task/test_selinux.py +++ b/teuthology/test/task/test_selinux.py @@ -7,7 +7,7 @@ from teuthology.task.selinux import SELinux class TestSELinux(object): - def setup(self): + def setup_method(self): self.ctx = FakeNamespace() self.ctx.config = dict() diff --git a/teuthology/test/test_config.py b/teuthology/test/test_config.py index cbf7c3ec..26200089 100644 --- a/teuthology/test/test_config.py +++ b/teuthology/test/test_config.py @@ -4,7 +4,7 @@ from teuthology import config class TestYamlConfig(object): - def setup(self): + def setup_method(self): self.test_class = config.YamlConfig def test_set_multiple(self): @@ -79,7 +79,7 @@ class TestYamlConfig(object): class TestTeuthologyConfig(TestYamlConfig): - def setup(self): + def setup_method(self): self.test_class = config.TeuthologyConfig def test_get_ceph_git_base_default(self): @@ -112,12 +112,12 @@ class TestTeuthologyConfig(TestYamlConfig): class TestJobConfig(TestYamlConfig): - def setup(self): + def setup_method(self): self.test_class = config.JobConfig class TestFakeNamespace(TestYamlConfig): - def setup(self): + def setup_method(self): self.test_class = config.FakeNamespace def test_docopt_dict(self): diff --git a/teuthology/test/test_contextutil.py b/teuthology/test/test_contextutil.py index d7d1f432..c433c82c 100644 --- a/teuthology/test/test_contextutil.py +++ b/teuthology/test/test_contextutil.py @@ -5,7 +5,7 @@ from logging import ERROR class TestSafeWhile(object): - def setup(self): + def setup_method(self): contextutil.log.setLevel(ERROR) self.fake_sleep = lambda s: True self.s_while = contextutil.safe_while diff --git a/teuthology/test/test_describe_tests.py b/teuthology/test/test_describe_tests.py index c6577d66..04d17770 100644 --- a/teuthology/test/test_describe_tests.py +++ b/teuthology/test/test_describe_tests.py @@ -129,7 +129,7 @@ expected_rbd_features = [ class TestDescribeTests(object): - def setup(self): + def setup_method(self): self.mocks = dict() self.patchers = dict() exists, listdir, isfile, isdir, open = make_fake_fstools(realistic_fs) @@ -153,7 +153,7 @@ class TestDescribeTests(object): for patcher in self.patchers.values(): patcher.stop() - def teardown(self): + def teardown_method(self): self.stop_patchers() @staticmethod diff --git a/teuthology/test/test_email_sleep_before_teardown.py b/teuthology/test/test_email_sleep_before_teardown.py index fcc83b69..60fcd245 100644 --- a/teuthology/test/test_email_sleep_before_teardown.py +++ b/teuthology/test/test_email_sleep_before_teardown.py @@ -6,7 +6,7 @@ from teuthology.run_tasks import build_email_body as email_body from textwrap import dedent class TestSleepBeforeTeardownEmail(object): - def setup(self): + def setup_method(self): config.results_ui_server = "http://example.com/" config.archive_server = "http://qa-proxy.ceph.com/teuthology/" diff --git a/teuthology/test/test_exit.py b/teuthology/test/test_exit.py index b7004fd7..11125b93 100644 --- a/teuthology/test/test_exit.py +++ b/teuthology/test/test_exit.py @@ -11,7 +11,7 @@ from teuthology.test import skipif_teuthology_process class TestExiter(object): klass = exit.Exiter - def setup(self): + def setup_method(self): self.pid = os.getpid() # Below, we patch os.kill() in such a way that the first time it is @@ -36,7 +36,7 @@ class TestExiter(object): self.m_kill.side_effect = m_kill_unwrap - def teardown(self): + def teardown_method(self): self.patcher_kill.stop() del self.m_kill diff --git a/teuthology/test/test_get_distro.py b/teuthology/test/test_get_distro.py index 71104d39..b03ba7b6 100644 --- a/teuthology/test/test_get_distro.py +++ b/teuthology/test/test_get_distro.py @@ -7,7 +7,7 @@ class Mock: class TestGetDistro(object): - def setup(self): + def setup_method(self): self.fake_ctx = Mock() self.fake_ctx.config = {} # os_type in ctx will always default to None diff --git a/teuthology/test/test_get_distro_version.py b/teuthology/test/test_get_distro_version.py index 66a9093b..8a77e39b 100644 --- a/teuthology/test/test_get_distro_version.py +++ b/teuthology/test/test_get_distro_version.py @@ -7,7 +7,7 @@ class Mock: class TestGetDistroVersion(object): - def setup(self): + def setup_method(self): self.fake_ctx = Mock() self.fake_ctx.config = {} self.fake_ctx_noarg = Mock() diff --git a/teuthology/test/test_misc.py b/teuthology/test/test_misc.py index 97b499f7..22341239 100644 --- a/teuthology/test/test_misc.py +++ b/teuthology/test/test_misc.py @@ -251,10 +251,10 @@ def test_split_role(): assert actual_split == expected_split class TestHostnames(object): - def setup(self): + def setup_method(self): config._conf = dict() - def teardown(self): + def teardown_method(self): config.load() def test_canonicalize_hostname(self): diff --git a/teuthology/test/test_packaging.py b/teuthology/test/test_packaging.py index e497bb69..265b2f8c 100644 --- a/teuthology/test/test_packaging.py +++ b/teuthology/test/test_packaging.py @@ -306,7 +306,7 @@ class TestPackaging(object): class TestBuilderProject(object): klass = None - def setup(self): + def setup_method(self): if self.klass is None: pytest.skip() @@ -530,7 +530,7 @@ class TestBuilderProject(object): class TestShamanProject(TestBuilderProject): klass = packaging.ShamanProject - def setup(self): + def setup_method(self): self.p_config = patch('teuthology.packaging.config') self.m_config = self.p_config.start() self.m_config.use_shaman = True @@ -542,7 +542,7 @@ class TestShamanProject(TestBuilderProject): self.p_get = patch('requests.get') self.m_get = self.p_get.start() - def teardown(self): + def teardown_method(self): self.p_config.stop() self.p_get_config_value.stop() self.p_get.stop() diff --git a/teuthology/test/test_report.py b/teuthology/test/test_report.py index 1a33b12b..342cebdd 100644 --- a/teuthology/test/test_report.py +++ b/teuthology/test/test_report.py @@ -5,13 +5,13 @@ from teuthology import report class TestSerializer(object): - def setup(self): + def setup_method(self): self.archive = fake_archive.FakeArchive() self.archive.setup() self.archive_base = self.archive.archive_base self.reporter = report.ResultsReporter(archive_base=self.archive_base) - def teardown(self): + def teardown_method(self): self.archive.teardown() def test_all_runs_one_run(self): diff --git a/teuthology/test/test_results.py b/teuthology/test/test_results.py index f1dc5874..3d7ba93b 100644 --- a/teuthology/test/test_results.py +++ b/teuthology/test/test_results.py @@ -137,7 +137,7 @@ class TestResultsEmail(object): """).strip(), } - def setup(self): + def setup_method(self): config.results_ui_server = "http://example.com/" config.archive_server = "http://qa-proxy.ceph.com/teuthology/" diff --git a/teuthology/test/test_vps_os_vers_parameter_checking.py b/teuthology/test/test_vps_os_vers_parameter_checking.py index 43ad5ae3..7a4cfd32 100644 --- a/teuthology/test/test_vps_os_vers_parameter_checking.py +++ b/teuthology/test/test_vps_os_vers_parameter_checking.py @@ -6,7 +6,7 @@ from teuthology import provision class TestVpsOsVersionParamCheck(object): - def setup(self): + def setup_method(self): self.fake_ctx = Mock() self.fake_ctx.machine_type = 'vps' self.fake_ctx.num_to_lock = 1 diff --git a/teuthology/test/test_worker.py b/teuthology/test/test_worker.py index 87d3af88..877d9903 100644 --- a/teuthology/test/test_worker.py +++ b/teuthology/test/test_worker.py @@ -10,7 +10,7 @@ from teuthology.contextutil import MaxWhileTries class TestWorker(object): - def setup(self): + def setup_method(self): self.ctx = Mock() self.ctx.verbose = True self.ctx.archive_dir = '/archive/dir'