Skip to content

Replace asserts with explicit checks in APIEndpoint validation - #289

Closed
eve-ci-cd[bot] wants to merge 1 commit into
mainfrom
improvement/explicit-api-endpoint-validation
Closed

eve-ci-cd[bot] wants to merge 1 commit into
mainfrom
improvement/explicit-api-endpoint-validation

Conversation

@eve-ci-cd

@eve-ci-cd eve-ci-cd Bot commented Sep 30, 2026

Copy link
Copy Markdown

APIEndpoint.__init_subclass__ validated endpoint definitions with assert, which is stripped when Python runs with -O. This replaces them with explicit TypeError/ValueError raises carrying clear messages (class name, offending value). Behaviour is otherwise unchanged.

Tests: pytest bert_e/tests/test_server.py passes (23), flake8 clean.

asserts are stripped under python -O, silently disabling the
class-definition sanity checks. Raise TypeError/ValueError instead.
@eve-ci-cd
eve-ci-cd Bot requested a review from a team as a code owner September 30, 2026 14:19
@codecov

codecov Bot commented Sep 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 55.55556% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.18%. Comparing base (cfe0bc2) to head (6768d98).

Files with missing lines Patch % Lines
bert_e/server/api/base.py 55.55% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #289      +/-   ##
==========================================
- Coverage   90.21%   90.18%   -0.04%     
==========================================
  Files          82       82              
  Lines       11293    11296       +3     
==========================================
- Hits        10188    10187       -1     
- Misses       1105     1109       +4     
Flag Coverage Δ
integration 87.68% <ø> (ø)
tests 87.64% <ø> (ø)
tests-BuildFailedTest 25.71% <ø> (ø)
tests-QuickTest 33.02% <ø> (ø)
tests-RepositoryTests 25.39% <ø> (ø)
tests-TaskQueueTests 49.60% <ø> (ø)
tests-TestBertE 66.97% <ø> (ø)
tests-TestQueueing 51.69% <ø> (ø)
tests-api-mock 14.44% <0.00%> (-0.01%) ⬇️
tests-noqueue 78.38% <ø> (ø)
tests-noqueue-BuildFailedTest 25.71% <ø> (ø)
tests-noqueue-QuickTest 33.02% <ø> (ø)
tests-noqueue-RepositoryTests 25.39% <ø> (ø)
tests-noqueue-TaskQueueTests 49.60% <ø> (ø)
tests-noqueue-TestBertE 63.55% <ø> (ø)
tests-noqueue-TestQueueing 25.41% <ø> (ø)
tests-server 26.70% <55.55%> (-0.02%) ⬇️
unittests 43.39% <55.55%> (-0.03%) ⬇️
utests 29.09% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

1 participant