Skip to content

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

Merged
wiresio merged 2 commits intoeclipse-thingweb:mainfrom
jona42-ui:fix/test-mock-reuse
Mar 19, 2026
Merged

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

Conversation

@jona42-ui
Copy link
Copy Markdown
Contributor

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

Fixes #24

Copilot AI review requested due to automatic review settings March 9, 2026 04:11
Copy link
Copy Markdown

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 thread tdd/common.py
Comment thread tdd/lib/__init__.py Outdated
@@ -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.
…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>
@jona42-ui jona42-ui force-pushed the fix/test-mock-reuse branch from dbb062c to 8f6dc97 Compare March 18, 2026 19:38
@wiresio wiresio merged commit 793691e into eclipse-thingweb:main Mar 19, 2026
2 of 3 checks passed
@wiresio
Copy link
Copy Markdown
Member

wiresio commented Mar 19, 2026

Thanks @jona42-ui!

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

3 participants