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

Improve tests #757

Merged
merged 7 commits into from
Nov 17, 2023
Merged

Improve tests #757

merged 7 commits into from
Nov 17, 2023

Conversation

tomicapretto
Copy link
Collaborator

@tomicapretto tomicapretto commented Nov 14, 2023

As I wrote in #753, our tests were taking too much time to run. One of the reasons is that we had a test_predict.py file where we wanted to test whether we could compute predictions for a variety of models, but we ended up rebuilding and refitting many models already tested in test_built_models.py.

In this PR I'm moving and merging many tests from test_predict.py and test_built_model.py into test_models.py. There's a class for every model family. There we implement as many methods as needed. The goal is to avoid building and fitting the same model more than once.

I'm sure there's still room for improvement and reorganization. But I think this is now in a better state. And on top of that, I already invested a couple of days on this and I think it's more than enough 😅.

As soon as the run finishes on my end I will add the time it takes now. Before these changes, running the tests took 1709.07 seconds on my end (28:29 minutes)

Edit After the changes it took 949.76 seconds (15:49)

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (c6e5dbb) 89.90% compared to head (e003f73) 89.60%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #757      +/-   ##
==========================================
- Coverage   89.90%   89.60%   -0.30%     
==========================================
  Files          45       45              
  Lines        3713     3713              
==========================================
- Hits         3338     3327      -11     
- Misses        375      386      +11     

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

Copy link
Collaborator

@GStechschulte GStechschulte left a comment

Choose a reason for hiding this comment

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

This is great! Also good to have added tests for: alternative samplers, dropping NaNs, amongst others.

I think this is good for now. But I know pytest also allows for a conftest.py file that allows you to reuse fixtures in multiple test files. Perhaps in the future we could explore putting simulated data and built models in this file to share amongst the other test files. For example, any test functions for interpret requires loading / simulating of data and building models also.

@GStechschulte GStechschulte merged commit 8dd25b1 into bambinos:main Nov 17, 2023
4 checks passed
GStechschulte added a commit that referenced this pull request Nov 17, 2023
@GStechschulte
Copy link
Collaborator

@tomicapretto I am pretty sure I prematurely merged this into main. Even though all the checks passed, this branch is behind main by 2 commits (per viewing this PR's branch). I think we need to revert and rebase first.

@GStechschulte
Copy link
Collaborator

GStechschulte commented Nov 20, 2023

@tomicapretto I am pretty sure I prematurely merged this into main. Even though all the checks passed, this branch is behind main by 2 commits (per viewing this PR's branch). I think we need to revert and rebase first.

Did we ever take care of this? 🙈

@tomicapretto tomicapretto deleted the improve_tests branch November 23, 2023 18:39
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.

3 participants