Skip to content

Commit 3fe8d96

Browse files
committed
Enable PYTHONWARNDEFAULTENCODING to catch an encoding mistake.
(These files are all ASCII AFAIR, so probably it didn't matter much, this line came more or less from jsonschema where I don't think anyone reported a concrete issue, but nevertheless, it's wrong.) Closes: python-jsonschema/jsonschema#1107
1 parent a080274 commit 3fe8d96

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

jsonschema_specifications/_core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ def _schemas():
2828
for child in version.iterdir():
2929
children = [child] if child.is_file() else child.iterdir()
3030
for path in children:
31-
contents = json.loads(path.read_text())
31+
contents = json.loads(path.read_text(encoding="utf-8"))
3232
yield Resource.from_contents(contents)

noxfile.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from pathlib import Path
2+
import os
23

34
import nox
45

@@ -23,7 +24,8 @@ def _session(fn):
2324
@session(python=["3.8", "3.9", "3.10", "3.11", "pypy3"])
2425
def tests(session):
2526
session.install("pytest", ROOT)
26-
session.run("pytest", "--verbosity=3")
27+
env = dict(os.environ, PYTHONWARNDEFAULTENCODING="1")
28+
session.run("pytest", "--verbosity=3", "--pythonwarnings=error", env=env)
2729

2830

2931
@session()

0 commit comments

Comments
 (0)