Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use different database for unit tests #2993

Merged
merged 17 commits into from
May 31, 2023

Conversation

gabrielmbmb
Copy link
Member

@gabrielmbmb gabrielmbmb commented May 25, 2023

Description

I've updated the unit test setup to use a different database than the one used by the local deployment of the Argilla server. In addition, I've updated the pytest fixtures that provided a connection to the DB, and now before executing every test a new transaction is created that gets rollbacked when the execution of the test has finished, leaving no traces in the DB.

Also, I've aligned the SQLAlchemy models metadata with the metadata in the current alembic migrations scripts.

Closes #2987

Type of change

  • New feature (non-breaking change which adds functionality)
  • Refactor (change restructuring the codebase without changing functionality)
  • Improvement (change adding some improvement to an existing functionality)

How Has This Been Tested

All the unit tests are passing using this new DB for the tests.

Checklist

  • I have merged the original branch into my forked branch
  • I added relevant documentation
  • follows the style guidelines of this project
  • I did a self-review of my code
  • I made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I have added relevant notes to the CHANGELOG.md file (See https://keepachangelog.com/)

@gabrielmbmb gabrielmbmb added the type: enhancement Indicates new feature requests label May 25, 2023
@gabrielmbmb gabrielmbmb linked an issue May 25, 2023 that may be closed by this pull request
@codecov
Copy link

codecov bot commented May 26, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: -0.03 ⚠️

Comparison is base (7866ee4) 92.90% compared to head (93b1487) 92.87%.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2993      +/-   ##
===========================================
- Coverage    92.90%   92.87%   -0.03%     
===========================================
  Files          204      204              
  Lines        10793    10799       +6     
===========================================
+ Hits         10027    10030       +3     
- Misses         766      769       +3     
Flag Coverage Δ
pytest 92.87% <100.00%> (-0.03%) ⬇️

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

Impacted Files Coverage Δ
src/argilla/__main__.py 100.00% <100.00%> (ø)
src/argilla/server/commons/telemetry.py 89.09% <100.00%> (-0.20%) ⬇️
src/argilla/server/database.py 92.30% <100.00%> (+0.30%) ⬆️
src/argilla/server/models/models.py 97.82% <100.00%> (+0.09%) ⬆️
src/argilla/tasks/__init__.py 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@gabrielmbmb gabrielmbmb marked this pull request as ready for review May 26, 2023 13:07
@gabrielmbmb gabrielmbmb changed the title feat: use different database for unit tests refactor: use different database for unit tests May 26, 2023
@gabrielmbmb gabrielmbmb changed the title refactor: use different database for unit tests feat: use different database for unit tests May 26, 2023
Copy link
Member

@frascuchon frascuchon left a comment

Choose a reason for hiding this comment

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

super nice!

@frascuchon frascuchon merged commit b06e703 into develop May 31, 2023
@frascuchon frascuchon deleted the feat/different-database-unit-tests branch May 31, 2023 10:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement Indicates new feature requests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use different database to run the unit tests
2 participants