-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
[Community Sprint] Improving Code Coverage 🚀 #6528
Labels
Comments
rusty1s
added a commit
that referenced
this issue
Feb 8, 2023
Improve coverage for `tests_inits.py` (#6528) --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Matthias Fey <matthias.fey@tu-dortmund.de>
rusty1s
added a commit
that referenced
this issue
Feb 23, 2023
Part of #6528, improves typing and code coverage for "[SchNet: A Continuous-filter Convolutional Neural Network for Modeling Quantum Interactions](https://arxiv.org/abs/1706.08566)" --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: rusty1s <matthias.fey@tu-dortmund.de>
rusty1s
added a commit
that referenced
this issue
Feb 24, 2023
Part of #6528, improves typing and code coverage for DimeNet. --------- Co-authored-by: rusty1s <matthias.fey@tu-dortmund.de>
This was referenced Jul 24, 2023
rusty1s
added a commit
that referenced
this issue
Jul 31, 2023
… homogeneous graphs (#7807) Fixes `edge_label_time.size() == (2*batch_size,)` to have `(batch_size,)`. Adds a test case for #7791. Part of #7796 and #6528. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: rusty1s <matthias.fey@tu-dortmund.de>
rusty1s
added a commit
that referenced
this issue
Aug 1, 2023
Part of #6528. IMO, exceptions are also part of the public API so we should measure the test coverage over them, but feel free to close this PR if you think otherwise ;) --------- Co-authored-by: rusty1s <matthias.fey@tu-dortmund.de>
rusty1s
added a commit
that referenced
this issue
Aug 10, 2023
Part of #6528. --------- Co-authored-by: rusty1s <matthias.fey@tu-dortmund.de>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
🚀 The feature, motivation and pitch
We are kicking off our third community sprint!
This community sprint resolves around improving test coverage across the PyG code base.
Currently, our tests cover 85.68% of all code in PyG. The goal of the community sprint is to bump this number into the high 90s (and to get yourself more familiar with the various parts of the code base). Each individual contribution is designed to only take around 30 minutes to two hours to complete.
The sprint begins Friday Janurary 27th and will last 2 weeks. If you are interested in helping out, please also join our PyG slack channel
#code-coverage-sprint
for more information.You can assign yourself to the test you are planning to work on here (code-coverage tab).
🚀 Improving Code Coverage
Example
Take a look at the current code coverage report of PyG. For example, we can see that we never test the
copy()
function of theInMemoryDataset
class, see here:As such, we create a
test_in_memory_dataset_copy()
function intest/data/test_dataset.py
to add a corresponding test:Furthermore, we see in the code coverage report that
copy()
utilizes different code paths, depending on whether the dataset should be filtered before copying. As such, we test this functionality as well:We can check that everything works by running
pytest test/data/test_dataset.py -k test_in_memory_dataset_copy
:Guide to contributing
See here for a basic example to follow.
InMemoryDataset
#6523. For this, look closely at the parts of a model and function you want to cover. Think about test cases that would increase the coverage. If you stumble upon a bug in untested code paths, try to fix the bug on your own, create a GitHub issue or discuss it with us in our PyG slack channel#code-coverage-sprint
.{model_name/function_name}
". Afterwards, add your PR number to the "Improved code coverage" line inCHANGELOG.md
.Tips for making your PR
pytest
to run all tests.test/
directory. For example, tests fortorch_geometric/utils/isolated.py
can be found intest/utils/test_isolated.py
. You can run individual test files viapytest test/utils/test_isolated.py
. You can run individual test functions viapytest test/utils/test_isolated.py -k test_contains_isolated_nodes
.@pytest.mark.parametrize('arg_name', [1, 2, 3])
to test different configurations inside your test. See here for an example.torch_geometric/testing/decorators.py
, e.g., to only run with specific packages installed via the@withPackage('networkx')
decorator.# pragma: no cover
comment, e.g.,@overload
routinesTests to update
This list may be incomplete. If you still find a function with missing code coverage, please let us know or add them on your own.
data/lightning/datamodule.py
([Code Coverage]data/lightning/datamodule.py
#6858)data/data.py
(Update graph.py #8074)data/datapipes.py
([Code Coverage]data/datapipes.py
#6799, [Code Coverage]data/datapipes.py
#7195)data/dataset.py
data/feature_store.py
([Code Coverage]data/feature_store.py
#6678)data/graph_store.py
([Code Coverage]data/graph_store.py
#6720)data/hetero_data.py
(Update graph.py #8074)data/storage.py
([Code Coverage]data/storage.py
#6677)data/temporal.py
([Code Coverage]data/temporal.py
#6735)data/view.py
([Code Coverage]data/view.py
#7093)explain/explainer.py
explain/gnn_explainer.py
([Code Coverage]explain/algorithm/gnn_explainer.py
#6676)explain/attention_explainer.py
([Code Coverage]explain/algorithm/attention_explainer.py
#6667)explain/captum_explainer.py
([Code Coverage]explain/captum_explainer.py
#6797)explain/pg_explainer.py
([Code Coverage]explain/pg_explainer.py
#6824)loader/dataloader.py
([Code Coverage]loader/test_dataloader.py
#6648)loader/imbalanced_sampler.py
([Code Coverage]loader/imbalanced_sampler.py
#6664)loader/utils.py
([Code Coverage]loader/utils.py
#7857)loader/temporal_dataloader.py
([Code Coverage]loader/temporal_dataloader.py
andnn/conv/transformer_conv.py
#7968)loader/neighbor_sampler.py
([Code Coverage]NeighborSampler
#6538)profile/profile.py
([Code Coverage]test_profile
#6555)profile/profiler.py
([Code Coverage]test_profiler
#6573)profile/utils.py
([Code Coverage]profile/utils
#6618)sampler/utils.py
utils/assortativity.py
([Code Coverage]utils/assortativity.py
#6578)utils/convert.py
([Code Coverage]utils/convert.py
#6653)utils/loop.py
([Code Coverage]utils/loop.py
#6647)utils/negative_sampling.py
([Code Coverage]utils/negative_sampling.py
#6619)utils/num_nodes.py
([Code Coverage]utils/num_nodes.py
#6669)transforms/compose.py
([Code Coverage]nn/conv/rgat_conv.py
andtransforms/compose.py
#7937)transforms/add_self_loops.py
([Code Coverage]transforms/add_self_loops.py
#6668)transforms/largest_connected_components.py
([Code Coverage]transforms/largest_connected_components.py
#6670)transforms/linear_transformation.py
([Code Coverage]transforms/linear_transformation.py
#6657)transforms/random_link_split.py
([Code Coverage]transforms/random_link_split.py
#6671)transforms/remove_traning_classes.py
([Code coverage]transforms/RemoveTrainingClasses
#6640)transforms/sign.py
([Code Coverage]transforms/sign.py
#6683)transforms/svd_feature_reduction.py
([Code Coverage]transforms/test_svd_feature_reduction.py
#6736)transforms/to_device.py
([Code Coverage]transforms/to_device.py
#6621)transforms/gcn_norm.py
([Code Coverage]transforms/gcn_norm.py
#6673)nn/conv/appnp.py
([Code Coverage]APPNP
#6558)nn/conv/eg_conv.py
(Update graph.py #8074)nn/conv/fa_conv.py
([Code Coverage]nn/conv/fa_conv.py
#6681)nn/conv/gen_conv.py
([Code Coverage]nn/conv/gen_conv.py
#6703)nn/conv/hetero_conv.py
([Code Coverage]HeteroConv
#6568)nn/conv/pna_conv.py
([Code Coverage]PNAConv
andDegreeScalerAggregation
#6600)nn/conv/rgat_conv.py
([Code Coverage]nn/conv/rgat_conv.py
andtransforms/compose.py
#7937)nn/conv/transformer_conv.py
([Code Coverage]loader/temporal_dataloader.py
andnn/conv/transformer_conv.py
#7968)nn/aggr/scaler.py
([Code Coverage]PNAConv
andDegreeScalerAggregation
#6600)nn/dense/linear.py
nn/models/correct_and_smooth.py
([Code Coverage]models/test_correct_and_smooth.py
#6637)nn/models/dimenet.py
([Code Coverage]models/dimenet.py
#6781)nn/models/label_prob.py
([Code Coverage]:models/LabelPropagation
#6597)nn/models/rect.py
([Code Coverage]models/RECT_L
#6623)nn/models/schnet.py
([Code Coverage]models/schnet.py
#6763)nn/models/tgn.py
([Code Coverage]models/tgn.py
#6662)nn/inits.py
([Code Coverage]test_inits.py
#6645)experimental.py
home.py
([Code Coverage]test_home.py
#6638)The text was updated successfully, but these errors were encountered: