aboutsummaryrefslogtreecommitdiff
path: root/test/test_unicode_literals.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_unicode_literals.py
parentaac33155e40af3da96a2467dd05faea201815989 (diff)
[compat] Use `compat_open()`
Diffstat (limited to 'test/test_unicode_literals.py')
-rw-r--r--test/test_unicode_literals.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/test/test_unicode_literals.py b/test/test_unicode_literals.py
index c7c2252f5..0c83f2a0c 100644
--- a/test/test_unicode_literals.py
+++ b/test/test_unicode_literals.py
@@ -2,14 +2,15 @@ from __future__ import unicode_literals
# Allow direct execution
import os
+import re
import sys
import unittest
-sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-import io
-import re
+dirn = os.path.dirname
+
+rootDir = dirn(dirn(os.path.abspath(__file__)))
-rootDir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+sys.path.insert(0, rootDir)
IGNORED_FILES = [
'setup.py', # http://bugs.python.org/issue13943
@@ -24,6 +25,7 @@ IGNORED_DIRS = [
]
from test.helper import assertRegexpMatches
+from youtube_dl.compat import compat_open as open
class TestUnicodeLiterals(unittest.TestCase):
@@ -41,7 +43,7 @@ class TestUnicodeLiterals(unittest.TestCase):
continue
fn = os.path.join(dirpath, basename)
- with io.open(fn, encoding='utf-8') as inf:
+ with open(fn, encoding='utf-8') as inf:
code = inf.read()
if "'" not in code and '"' not in code: