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

Mirror codebase structure in tests #6084

Merged
merged 4 commits into from
Sep 4, 2022

Conversation

Armavica
Copy link
Member

@Armavica Armavica commented Aug 31, 2022

What is this PR about?

This PR splits up the test files test_distribution.py, test_moments.py and test_random.py, to start tackling issue #5777.

Checklist

Major / Breaking Changes

  • ...

Bugfixes / New features

  • ...

Docs / Maintenance

  • Break up test_distribution.py, test_moments.py and test_random.py in more specific files.

@codecov
Copy link

codecov bot commented Aug 31, 2022

Codecov Report

Merging #6084 (32b16fa) into main (0b191ad) will increase coverage by 2.22%.
The diff coverage is 97.61%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #6084      +/-   ##
==========================================
+ Coverage   89.54%   91.76%   +2.22%     
==========================================
  Files          72       86      +14     
  Lines       12929    17692    +4763     
==========================================
+ Hits        11577    16235    +4658     
- Misses       1352     1457     +105     
Impacted Files Coverage Δ
pymc/tests/distributions/test_dist_math.py 99.25% <ø> (ø)
pymc/tests/distributions/test_timeseries.py 94.06% <85.71%> (ø)
pymc/tests/distributions/util.py 91.08% <91.08%> (ø)
pymc/tests/distributions/test_distribution.py 97.46% <97.46%> (ø)
pymc/tests/distributions/test_multivariate.py 97.73% <97.73%> (ø)
pymc/tests/distributions/test_discrete.py 98.87% <98.87%> (ø)
pymc/tests/distributions/test_continuous.py 99.76% <99.76%> (ø)
pymc/distributions/continuous.py 97.51% <100.00%> (ø)
pymc/tests/distributions/test_bound.py 100.00% <100.00%> (ø)
pymc/tests/distributions/test_censored.py 100.00% <100.00%> (ø)
... and 15 more

@ricardoV94
Copy link
Member

This draft PR is a WIP to tackle issue #5777, posted early to avoid duplication of effort.

To avoid conflicts with the other PRs I would suggest we merge this earlier rather than later.

pymc/tests/distributions/test_distribution.py Outdated Show resolved Hide resolved
pymc/tests/distributions/test_distribution.py Outdated Show resolved Hide resolved
pymc/tests/distributions/test_distribution.py Outdated Show resolved Hide resolved
pymc/tests/distributions/test_distribution.py Outdated Show resolved Hide resolved
pymc/tests/distributions/test_distribution.py Outdated Show resolved Hide resolved
pymc/tests/distributions/test_distribution.py Outdated Show resolved Hide resolved
pymc/tests/distributions/test_distribution.py Outdated Show resolved Hide resolved
pymc/tests/distributions/test_distribution.py Outdated Show resolved Hide resolved
pymc/tests/distributions/test_distribution.py Outdated Show resolved Hide resolved
pymc/tests/distributions/test_distribution.py Outdated Show resolved Hide resolved
@Armavica
Copy link
Member Author

Armavica commented Sep 1, 2022

To avoid conflicts with the other PRs I would suggest we merge this earlier rather than later.

Thank you. I don't mind rebasing, but I see what I can do tonight.

@ricardoV94
Copy link
Member

I didn't mean you have to rush like that. Just giving it priority over other PRs.

@Armavica
Copy link
Member Author

Armavica commented Sep 3, 2022

The files test_distribution.py, test_moment.py and test_random.py are more or less done. I am just not sure what to do with the final test that remains in test_random.py.

I am planning to work on the others this weekend (gp, ode, smc, step_methods, hmc, tuning, variational), but you can merge this one now if you want, it is fine for me either way.

pymc/tests/distributions/test_random.py Outdated Show resolved Hide resolved
pymc/tests/distributions/test_timeseries.py Outdated Show resolved Hide resolved
pymc/tests/distributions/test_distribution.py Outdated Show resolved Hide resolved
@ricardoV94
Copy link
Member

ricardoV94 commented Sep 3, 2022

I am planning to work on the others this weekend (gp, ode, smc, hmc, tuning, variational), but you can merge this one now if you want, it is fine for me either way.

Yes let's keep this PR just about the distribution tests

@ricardoV94
Copy link
Member

Looks nearly done. I left some final suggestions. Once you address them I think we can merge.

@ricardoV94
Copy link
Member

Can you add a bullet point in the maintenance section on the top PR post?

Also some tests seem to be failing, let me know if you need help with those (haven't peaked at the logs)

@Armavica
Copy link
Member Author

Armavica commented Sep 3, 2022

Thank you for your review! Yes, the tests should be fixable. The only one that I don't understand is the docs: it fails to build the 404 page for an obscure reason... Do you have an idea about this? And it was the same error for the first version of the PR.

@ricardoV94
Copy link
Member

I think the docs build has been failing everywhere, you can ignore it

@Armavica Armavica force-pushed the structure-tests branch 2 times, most recently from e0f336f to bf316ac Compare September 3, 2022 19:30
@Armavica Armavica marked this pull request as ready for review September 3, 2022 20:14
@Armavica
Copy link
Member Author

Armavica commented Sep 3, 2022

I think it is all set now. We should probably think of rebalancing the github test workers at some point, with many tests having moved around.

@ricardoV94
Copy link
Member

We should probably think of rebalancing the github test workers at some point, with many tests having moved around.

Yes, after a few more PRs get open/merged we can get an idea of the average runtime to rebalance.

evaled_moment = moment(a).eval({mu: mu_val})


def test_all_distributions_have_moments():
Copy link
Member

Choose a reason for hiding this comment

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

This seems to be repeated above

Copy link
Member

Choose a reason for hiding this comment

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

Still looks unresolved on my end? Codecov is complaining the test above are not being covered, which agress with them still being duplicated.

)


class TestDensityDist:
Copy link
Member

Choose a reason for hiding this comment

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

There's already a TestDensityDist class above

Copy link
Member

Choose a reason for hiding this comment

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

Still duplicated above?

pymc/tests/distributions/test_timeseries.py Outdated Show resolved Hide resolved
@Armavica
Copy link
Member Author

Armavica commented Sep 3, 2022

Argh, my bad, tricky rebasing… Good catches.

@canyon289
Copy link
Member

@Armavica youre doing an amazing job. Thanks for all the effort

Copy link
Member

@ricardoV94 ricardoV94 left a comment

Choose a reason for hiding this comment

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

Still some duplicated tests in test_distributions and an indentation error that is putting two tests inside the previous one. I know how painful rebases can be :D

Otherwise looks great!!!

),
],
)
def test_asymmetriclaplace_moment(b, kappa, mu, size, expected):
Copy link
Member

Choose a reason for hiding this comment

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

This one is missing an indentation, which is causing the following tests to be inside it and not run (codecov warning)

evaled_moment = moment(a).eval({mu: mu_val})


def test_all_distributions_have_moments():
Copy link
Member

Choose a reason for hiding this comment

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

Still looks unresolved on my end? Codecov is complaining the test above are not being covered, which agress with them still being duplicated.

)


class TestDensityDist:
Copy link
Member

Choose a reason for hiding this comment

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

Still duplicated above?

@Armavica
Copy link
Member Author

Armavica commented Sep 4, 2022

Ok, I understood my mistake: I think I was repeatedly trying to fix the wrong commit. The rebase went without problem this time so I think that it should be ok. And thank you for mentioning codecov: I understood where to look to spot all of this.

@ricardoV94 ricardoV94 merged commit 4c4d71c into pymc-devs:main Sep 4, 2022
@ricardoV94
Copy link
Member

Merged! Thanks for this :) Feel free to break some more eggs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants