aboutsummaryrefslogtreecommitdiff
path: root/test/test_write_annotations.py
diff options
context:
space:
mode:
authordirkf <fieldhouse@gmx.net>2023-07-25 00:17:15 +0100
committerdirkf <fieldhouse@gmx.net>2023-07-25 13:19:43 +0100
commita25e9f3c84a34d43f78a4e5a6f6c2e98e2a0ade3 (patch)
tree869bde60dab873963705baae5b879b94a4b9c3a9 /test/test_write_annotations.py
parentaac33155e40af3da96a2467dd05faea201815989 (diff)
[compat] Use `compat_open()`
Diffstat (limited to 'test/test_write_annotations.py')
-rw-r--r--test/test_write_annotations.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/test/test_write_annotations.py b/test/test_write_annotations.py
index 41abdfe3b..68e0a391d 100644
--- a/test/test_write_annotations.py
+++ b/test/test_write_annotations.py
@@ -11,12 +11,11 @@ sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from test.helper import get_params, try_rm
-import io
-
import xml.etree.ElementTree
import youtube_dl.YoutubeDL
import youtube_dl.extractor
+from youtube_dl.compat import compat_open as open
class YoutubeDL(youtube_dl.YoutubeDL):
@@ -51,7 +50,7 @@ class TestAnnotations(unittest.TestCase):
ydl.download([TEST_ID])
self.assertTrue(os.path.exists(ANNOTATIONS_FILE))
annoxml = None
- with io.open(ANNOTATIONS_FILE, 'r', encoding='utf-8') as annof:
+ with open(ANNOTATIONS_FILE, 'r', encoding='utf-8') as annof:
annoxml = xml.etree.ElementTree.parse(annof)
self.assertTrue(annoxml is not None, 'Failed to parse annotations XML')
root = annoxml.getroot()