Skip to content

Commit

Permalink
Revert "chore: Override showwarning per Python docs, not formatwarning"
Browse files Browse the repository at this point in the history
This reverts commit 49ee11e.
  • Loading branch information
jpmckinney committed Jun 13, 2023
1 parent 49ee11e commit 3fc6625
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions jscc/testing/checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def validate_json_schema(path, name, data, schema):
assert not errors, 'One or more JSON Schema files are invalid. See warnings below.'
You can monkeypatch ``warnings.showwarning`` to customize and abbreviate the warning messages:
You can monkeypatch ``warnings.formatwarning`` to customize and abbreviate the warning messages:
.. code-block:: python
Expand All @@ -59,14 +59,14 @@ def validate_json_schema(path, name, data, schema):
cwd = os.getcwd()
def showwarning(message, category, filename, lineno, file=None, line=None):
def formatwarning(message, category, filename, lineno, line=None):
# Prefix warnings that count as errors with "ERROR: ".
if category != DeepPropertiesWarning:
message = 'ERROR: ' + message
# Remove the path to the current working directory.
return str(message).replace(cwd + os.sep, '')
warnings.showwarning = showwarning
warnings.formatwarning = formatwarning
"""

# In this module, it would be simpler to use a tuple for each `pointer` keyword argument, especially when calculating
Expand Down

0 comments on commit 3fc6625

Please sign in to comment.