Skip to content

fix: Resolve all test failures and improve error handling #25

Open
jona42-ui wants to merge 2 commits intoeclipse-thingweb:mainfrom
jona42-ui:fix/test-mock-reuse
Open

fix: Resolve all test failures and improve error handling #25
jona42-ui wants to merge 2 commits intoeclipse-thingweb:mainfrom
jona42-ui:fix/test-mock-reuse

Conversation

@jona42-ui
Copy link
Contributor

  • Added is reusable=True to HTTP mock callbacks
  • Fixed IDNotFound exception to use proper error handler instead of abort()

Fixes #24

…reusable=True to HTTP mock callbacks (fixes 21 tests) - Fixed IDNotFound exception to use proper error handler instead of abort() Fixes eclipse-thingweb#24

Signed-off-by: jona42-ui <jonathanthembo123@gmail.com>
Copilot AI review requested due to automatic review settings March 9, 2026 04:11
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to resolve current CI test failures and make error handling consistent with the app’s AppException JSON error responses (Fixes #24).

Changes:

  • Made pytest_httpx callbacks reusable in SPARQL mock fixtures to avoid callback exhaustion across multiple requests.
  • Replaced abort(404) with raising IDNotFound so Flask’s AppException handler returns application/problem+json.
  • Updated the test TDD description fixture to include response.contentType fields and reformatted JSON.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tdd/tests/data/tdd-description.json Reformats test fixture and adds missing response.contentType entries.
tdd/tests/conftest.py Updates httpx_mock.add_callback usage to be reusable across requests.
tdd/lib/init.py Adds package marker so tdd.lib works with importlib.resources.
tdd/errors.py Expands IDNotFound to provide a clearer title and localized messages.
tdd/common.py Switches 404 handling from abort() to raising IDNotFound.
.gitignore Ignores local venv and generated JS artifacts under tdd/lib.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +132 to +134
from tdd.errors import IDNotFound

raise IDNotFound()
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

abort is no longer used after switching to raising IDNotFound, but tdd/common.py still imports it (from flask import Response, abort). This will trigger flake8 F401 (unused import). Remove abort from the import list (or reintroduce its usage if intended).

Copilot uses AI. Check for mistakes.
@@ -0,0 +1 @@
# JavaScript library module
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is only used to make tdd.lib a Python package for importlib.resources; the current comment # JavaScript library module is potentially misleading given it’s a Python package. Consider replacing it with a short module docstring clarifying it exists to package/access built JS assets.

Suggested change
# JavaScript library module
"""Package providing access to built JavaScript assets via importlib.resources."""

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fixing Tests

2 participants