Skip to content

Commit

Permalink
Fix pytest warnings
Browse files Browse the repository at this point in the history
Fix deprecation warnings from pytest related to setup and teardown
deprecations.
  • Loading branch information
markstory committed Jul 25, 2023
1 parent d85f343 commit 12f9afa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions responses/tests/test_recorder.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def get_data(host, port):


class TestRecord:
def setup(self):
def setup_method(self):
self.out_file = Path("response_record")
if self.out_file.exists():
self.out_file.unlink() # pragma: no cover
Expand Down Expand Up @@ -141,10 +141,10 @@ def prepare_server(self, httpserver):


class TestReplay:
def setup(self):
def setup_method(self):
self.out_file = Path("response_record")

def teardown(self):
def teardown_method(self):
if self.out_file.exists():
self.out_file.unlink()

Expand Down
8 changes: 4 additions & 4 deletions responses/tests/test_responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -2342,13 +2342,13 @@ class TestUnitTestPatchSetup:
"""

def setup(self):
def setup_method(self):
self.r_mock = responses.RequestsMock(assert_all_requests_are_fired=True)
self.r_mock.start()
self.r_mock.get("https://example.com", status=505)
self.r_mock.put("https://example.com", status=506)

def teardown(self):
def teardown_method(self):
self.r_mock.stop()
self.r_mock.reset()

Expand All @@ -2369,13 +2369,13 @@ class TestUnitTestPatchSetupRaises:
"""

def setup(self):
def setup_method(self):
self.r_mock = responses.RequestsMock()
self.r_mock.start()
self.r_mock.get("https://example.com", status=505)
self.r_mock.put("https://example.com", status=506)

def teardown(self):
def teardown_method(self):
with pytest.raises(AssertionError) as exc:
self.r_mock.stop()
self.r_mock.reset()
Expand Down

0 comments on commit 12f9afa

Please sign in to comment.