Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ test-python:
-i coverage.xml \
-o htmlcov/coverage.svg

# View debug information for all tests
# Used to e.g. view output of explain() rather than seeing which tests failed
test-python-debug:
CDP_DEBUG=true uv run pytest -sv


# Check Python code for any errors that need manual attention
check-python:
# Check formatting
Expand Down
8 changes: 8 additions & 0 deletions src/check_datapackage/check.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import re
import sys
from dataclasses import dataclass, field
Expand Down Expand Up @@ -181,6 +182,13 @@ class for more details, especially about the default values.
issues = exclude(issues, config.exclusions)
issues = sorted(set(issues))

# Use by doing `CDP_DEBUG=true uv run ...`
if os.getenv("CDP_DEBUG"):
rprint("", properties)
for issue in issues:
rprint(issue)
rprint(explain([issue]))

if error and issues:
raise DataPackageError(issues)

Expand Down
15 changes: 15 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import os


# Can get debug output by using `CDP_DEBUG=true uv run pytest -sv`
def pytest_report_teststatus(report, config):
if os.getenv("CDP_DEBUG"):
if report.when == "call":
# Add newlines to separate test results
category = report.outcome
shortletter = "\n\n" # dot / F / X / etc.
verbose = "\n\n" # ("PASSED", "FAILED", ...)

return category, shortletter, verbose

return None
1 change: 1 addition & 0 deletions tools/vulture-allowlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
_check_not_required # unused method (src/check_datapackage/extensions.py:59)
_check_field_name_in_jsonpath # unused method (src/check_datapackage/extensions.py:117)
cls # unused variable (src/check_datapackage/extensions.py:61)
pytest_report_teststatus # unused function (tests/conftest.py:4)