]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-109505: Remove unnecessary `hasattr` checks from `test_asyncio` (#109506)
authorNikita Sobolev <mail@sobolevn.me>
Sat, 23 Sep 2023 04:14:15 +0000 (07:14 +0300)
committerGitHub <noreply@github.com>
Sat, 23 Sep 2023 04:14:15 +0000 (21:14 -0700)
Lib/test/test_asyncio/test_events.py
Lib/test/test_asyncio/utils.py

index 1647d2308c4e3555747c037aca106ebe7fa785d3..f22cb5e58bba62590e140e4e37c21b5f98d549ef 100644 (file)
@@ -1,6 +1,5 @@
 """Tests for events.py."""
 
-import collections.abc
 import concurrent.futures
 import functools
 import io
@@ -2335,8 +2334,6 @@ class HandleTests(test_utils.TestCase):
         h = loop.call_later(0, noop)
         check_source_traceback(h)
 
-    @unittest.skipUnless(hasattr(collections.abc, 'Coroutine'),
-                         'No collections.abc.Coroutine')
     def test_coroutine_like_object_debug_formatting(self):
         # Test that asyncio can format coroutines that are instances of
         # collections.abc.Coroutine, but lack cr_core or gi_code attributes
index 64eb4410bfb5dcd0146ab65e05cb34cbb7ace251..1e5ab6eb935ef154af3c5bc6d4fc828754854c28 100644 (file)
@@ -37,10 +37,9 @@ from test.support import threading_helper
 
 
 def data_file(*filename):
-    if hasattr(support, 'TEST_HOME_DIR'):
-        fullname = os.path.join(support.TEST_HOME_DIR, *filename)
-        if os.path.isfile(fullname):
-            return fullname
+    fullname = os.path.join(support.TEST_HOME_DIR, *filename)
+    if os.path.isfile(fullname):
+        return fullname
     fullname = os.path.join(os.path.dirname(__file__), '..', *filename)
     if os.path.isfile(fullname):
         return fullname