Skip to content

Commit

Permalink
Refactor failIf to assertFalse for Python 3.12 Compatibility
Browse files Browse the repository at this point in the history
This commit replaces deprecated failIf calls with assertFalse in the
test_resourced_test_case.py file. The failIf method was removed in
Python 3.12 [1-3].

[1] https://docs.python.org/3.12/whatsnew/3.12.html#removed
[2] python/cpython#89325
[3] python/cpython#28268

Signed-off-by: Petr Vaněk <[email protected]>
  • Loading branch information
arkamar committed May 31, 2023
1 parent b3f9450 commit 7bb62a1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions testresources/tests/test_resourced_test_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def testTearDownResourcesDeletesResourceAttributes(self):
self.resourced_case.resources = [("foo", self.resource_manager)]
self.resourced_case.setUpResources()
self.resourced_case.tearDownResources()
self.failIf(hasattr(self.resourced_case, "foo"))
self.assertFalse(hasattr(self.resourced_case, "foo"))

def testTearDownResourcesStopsUsingResource(self):
# tearDownResources records that there is one less use of each
Expand Down Expand Up @@ -158,5 +158,5 @@ def testSingleWithSetup(self):
self.assertEqual(self.resourced_case.foo, self.resource)
self.assertEqual(self.resource_manager._uses, 1)
self.resourced_case.tearDown()
self.failIf(hasattr(self.resourced_case, "foo"))
self.assertFalse(hasattr(self.resourced_case, "foo"))
self.assertEqual(self.resource_manager._uses, 0)

0 comments on commit 7bb62a1

Please sign in to comment.