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 test coverage #149

Closed
davidbuniat opened this issue Oct 29, 2020 · 9 comments · Fixed by #203
Closed

Improve test coverage #149

davidbuniat opened this issue Oct 29, 2020 · 9 comments · Fixed by #203
Assignees

Comments

@davidbuniat
Copy link
Member

Describe the issue

Our test coverage is low 64%, would love help in adding more tests for edge cases. Please follow the 20%-80% rule by identifying tests that with 20% of work will have 80% of the impact. This is also a good task for learning about the code.

Happy to discuss internals here.

@sohamsshah
Copy link
Contributor

I would love to work on this issue. Can you elaborate how to proceed to this?

@vvkpd
Copy link

vvkpd commented Nov 1, 2020

I would like to help on this one...

@davidbuniat
Copy link
Member Author

@rohankmr414 and @vvkpd great to see that you are interested in contributing! This is a very essential task for us at this point. To have a high impact code coverage we need to review the codecov report and understand where tests are missing mostly.

Codecov for some reason is not available at this point at least from me, but here is an example from one of the PRs (#145). It has already large modifications from the master, since we are working on v1-alpha version.

Impacted Files Coverage Δ  
hub/utils.py 57.77% <25.00%> (-11.92%) ⬇️
hub/api/datasetview.py 56.92% <49.09%> (-4.37%) ⬇️
hub/features/image.py 82.35% <50.00%> (+2.35%) ⬆️
hub/compute/pipeline.py 56.14% <56.14%> (ø)  
hub/store/store.py 77.77% <58.82%> (-9.41%) ⬇️
hub/store/cache.py 88.99% <66.66%> (+1.02%) ⬆️
hub/store/dynamic_tensor.py 85.29% <70.21%> (ø)  
hub/store/tests/test_storage_tensor.py 90.90% <72.72%> (-6.66%) ⬇️
hub/features/deserialize.py 90.69% <75.00%> (ø)  
hub/api/tensorview.py

To get started

  1. Any PR generates automatically codecov report or please take a look at codecov (once it is working).
  2. Identify files that have the least coverage.
  3. Claim it here to avoid conflict.
  4. Add unit tests for the specific file.py in the same folder undertests/test_file.py
  5. Please do a PR and check if the codecov got increased.

Please make sure that tests actually cover the meaning of the function 😄

@vvkpd
Copy link

vvkpd commented Nov 4, 2020

Do we have any communication channel?
Getting this error while running pytest .
`========================================================================= test session starts =========================================================================
platform darwin -- Python 3.9.0, pytest-6.1.2, py-1.9.0, pluggy-0.13.1
rootdir: /Users/vivekp/Projects/playground/Hub
collected 24 items / 1 error / 23 selected

=============================================================================== ERRORS ================================================================================
_______________________________________________________ ERROR collecting hub/areal/tests/test_storage_tensor.py _______________________________________________________
ImportError while importing test module '/Users/vivekp/Projects/playground/Hub/hub/areal/tests/test_storage_tensor.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/local/Cellar/python@3.9/3.9.0_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/init.py:127: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
hub/areal/tests/test_storage_tensor.py:5: in
from hub.areal.storage_tensor import StorageTensor
hub/areal/storage_tensor.py:4: in
import zarr
E ModuleNotFoundError: No module named 'zarr'
======================================================================= short test summary info =======================================================================
ERROR hub/areal/tests/test_storage_tensor.py
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
========================================================================== 1 error in 10.02s ========================================================================`
need help !!!

@davidbuniat
Copy link
Member Author

@vvkpd yes we have a slack channel please send an email to support@activeloop.ai and I will send an invite.

Otherwise feel free to use, GitHub Discussions or our dedicated Slack channel.

@davidbuniat
Copy link
Member Author

davidbuniat commented Nov 5, 2020

Describe the feature

@edogrigqv2 Since we are working on v1 please follow from release/v1.0.0-alpha, please PR to this branch.

[UPDATE]
We now are developing release/v1.0.0-beta, so new tests should be PRed there.

@edogrigqv2
Copy link
Contributor

First of all I think we have to define goal test coverage percentage for this issue. I think 80% is a good milestone for a start.
For those who want to get started with test coverage issue, @sohamsshah @vvkpd, here how to run test coverage.

 pytest --cov=hub --cov-report html hub

This will generate html report of entire package.
For now avoid hub/collections folder as it is deprecated and will be removed.
Soon I'll post which files first of all need to get their share of testing.

@edogrigqv2
Copy link
Contributor

edogrigqv2 commented Nov 13, 2020

Hey everyone, I have audited this and we seem to have very weak test coverage for hub/features and hub/cli. Would be very nice to have test cases specifically for them. @vvkpd, @sohamsshah, are you guys willing to take this up? You would help us immensely. If you can do only a part of the task, I'd be glad to coordinate so there is no work collision happening.

(if anyone else not mentioned on this thread wants to take this, please let me know).

@vvkpd
Copy link

vvkpd commented Nov 16, 2020

I was facing some issue in order to run unit test. I have posted issues on slack. @davidbuniat is helping me to resolve the things quickly. please check slack thread for more info.
Once, I will be able to run test then i will start adding unit tests.
Thanks

@davidbuniat davidbuniat linked a pull request Nov 18, 2020 that will close this issue
This was referenced Mar 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants