Skip to content

[DOP-23867] Implement model -> json converter for tests#163

Merged
dolfinus merged 1 commit intodevelopfrom
feature/DOP-23867-prepare
Feb 13, 2025
Merged

[DOP-23867] Implement model -> json converter for tests#163
dolfinus merged 1 commit intodevelopfrom
feature/DOP-23867-prepare

Conversation

@dolfinus
Copy link
Member

@dolfinus dolfinus commented Feb 12, 2025

Change Summary

Most of test lines are JSON output examples, and there are A LOT of them. It is very cumbersome to apply any changes to these tests (like change API schema) because this requires a lot of copy-pasting.

Instead, implement simple functions to convert SQLAlchemy model to JSON representation, and use for all API tests instead of raw JSON examples.

This reduces number of lines a lot (-4k). Also fixes flaky tests caused by datetime isoformat comparison, like 2025-01-01T11:22:33.000000Z != 2025-01-01T11:22:33Z.

Related issue number

Checklist

  • Commit message and PR title is comprehensive
  • Keep the change as small as possible
  • Unit and integration tests for the changes exist
  • Tests pass on CI and coverage does not decrease
  • Documentation reflects the changes where applicable
  • docs/changelog/next_release/<pull request or issue id>.<change type>.rst file added describing change
    (see CONTRIBUTING.rst for details.)
  • My PR is ready to review.

@dolfinus dolfinus self-assigned this Feb 12, 2025
@dolfinus dolfinus added the ci:skip-changelog Add this label to skip changelog file check label Feb 12, 2025
@dolfinus dolfinus force-pushed the feature/DOP-23867-prepare branch from 75a78a9 to ae67d3c Compare February 12, 2025 17:33
@dolfinus dolfinus force-pushed the feature/DOP-23867-prepare branch from ae67d3c to a01799e Compare February 12, 2025 17:36
@codecov
Copy link

codecov bot commented Feb 12, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.16%. Comparing base (a874b07) to head (124a89c).
Report is 134 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop     #163   +/-   ##
========================================
  Coverage    93.15%   93.16%           
========================================
  Files          184      185    +1     
  Lines         4208     4228   +20     
  Branches       281      281           
========================================
+ Hits          3920     3939   +19     
- Misses         226      227    +1     
  Partials        62       62           

☔ View full report in Codecov by Sentry.
📢 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.

@dolfinus dolfinus marked this pull request as ready for review February 12, 2025 17:39
@dolfinus dolfinus force-pushed the feature/DOP-23867-prepare branch from a01799e to 124a89c Compare February 13, 2025 08:49
@dolfinus dolfinus enabled auto-merge (rebase) February 13, 2025 08:49
@dolfinus dolfinus merged commit d9ac4dd into develop Feb 13, 2025
11 checks passed
@dolfinus dolfinus deleted the feature/DOP-23867-prepare branch February 13, 2025 08:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:skip-changelog Add this label to skip changelog file check

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants