From 995291505cbd012b00ff690fff0d76c1b94777e1 Mon Sep 17 00:00:00 2001 From: sobolevn Date: Sun, 17 Sep 2023 10:52:41 +0300 Subject: [PATCH] gh-109505: Remove expired `hasattr` checks from `test_asyncio` --- Lib/test/test_asyncio/test_events.py | 3 --- Lib/test/test_asyncio/utils.py | 7 +++---- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/Lib/test/test_asyncio/test_events.py b/Lib/test/test_asyncio/test_events.py index 1647d2308c4e355..f22cb5e58bba625 100644 --- a/Lib/test/test_asyncio/test_events.py +++ b/Lib/test/test_asyncio/test_events.py @@ -1,6 +1,5 @@ """Tests for events.py.""" -import collections.abc import concurrent.futures import functools import io @@ -2335,8 +2334,6 @@ def check_source_traceback(h): 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 diff --git a/Lib/test/test_asyncio/utils.py b/Lib/test/test_asyncio/utils.py index 64eb4410bfb5dcd..1e5ab6eb935ef15 100644 --- a/Lib/test/test_asyncio/utils.py +++ b/Lib/test/test_asyncio/utils.py @@ -37,10 +37,9 @@ 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