summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/contrast/test_contrasts.py4
-rw-r--r--tests/test_html_formatter_linenos_elements.py3
-rw-r--r--tests/test_latex_formatter.py4
3 files changed, 6 insertions, 5 deletions
diff --git a/tests/contrast/test_contrasts.py b/tests/contrast/test_contrasts.py
index 517b34ed..cfc9b414 100644
--- a/tests/contrast/test_contrasts.py
+++ b/tests/contrast/test_contrasts.py
@@ -60,7 +60,7 @@ def min_contrasts():
def update_json():
- with open(JSON_FILENAME, "w") as f:
+ with open(JSON_FILENAME, "w", encoding="utf-8") as f:
json.dump(
min_contrasts(),
f,
@@ -69,7 +69,7 @@ def update_json():
def test_contrasts(fail_if_improved=True):
- with open(JSON_FILENAME) as f:
+ with open(JSON_FILENAME, encoding="utf-8") as f:
previous_contrasts = json.load(f)
for style_name in pygments.styles.STYLE_MAP:
diff --git a/tests/test_html_formatter_linenos_elements.py b/tests/test_html_formatter_linenos_elements.py
index 286b60c9..af43c4b4 100644
--- a/tests/test_html_formatter_linenos_elements.py
+++ b/tests/test_html_formatter_linenos_elements.py
@@ -57,7 +57,8 @@ def test_linenos_elements(
# import bs4 as BeautifulSoup
# f.write(str(BeautifulSoup.BeautifulSoup(html, 'html.parser')))
- with open(os.path.join(EXPECTED_OUTPUT_DIR, expected_html_filename)) as f:
+ with open(os.path.join(EXPECTED_OUTPUT_DIR, expected_html_filename),
+ encoding="utf-8") as f:
expected_html = f.read()
structural_diff.structural_diff(html, expected_html)
diff --git a/tests/test_latex_formatter.py b/tests/test_latex_formatter.py
index 42c5eda7..65b3bac1 100644
--- a/tests/test_latex_formatter.py
+++ b/tests/test_latex_formatter.py
@@ -24,7 +24,7 @@ TESTFILE = path.join(TESTDIR, 'test_latex_formatter.py')
def test_correct_output():
- with open(TESTFILE) as fp:
+ with open(TESTFILE, encoding='utf-8') as fp:
tokensource = list(PythonLexer().get_tokens(fp.read()))
hfmt = LatexFormatter(nowrap=True)
houtfile = StringIO()
@@ -35,7 +35,7 @@ def test_correct_output():
def test_valid_output():
- with open(TESTFILE) as fp:
+ with open(TESTFILE, encoding='utf-8') as fp:
tokensource = list(PythonLexer().get_tokens(fp.read()))
fmt = LatexFormatter(full=True, encoding='latin1')