Skip to content

Commit

Permalink
Enable PYTHONWARNDEFAULTENCODING to catch an encoding mistake.
Browse files Browse the repository at this point in the history
(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
  • Loading branch information
Julian committed Jun 23, 2023
1 parent a080274 commit 3fe8d96
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion jsonschema_specifications/_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ def _schemas():
for child in version.iterdir():
children = [child] if child.is_file() else child.iterdir()
for path in children:
contents = json.loads(path.read_text())
contents = json.loads(path.read_text(encoding="utf-8"))
yield Resource.from_contents(contents)
4 changes: 3 additions & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from pathlib import Path
import os

import nox

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


@session()
Expand Down

0 comments on commit 3fe8d96

Please sign in to comment.