Test Registry project

4 posts were merged into an existing topic: Feasibility Study - Notebook API Demo Registry to link into fast.ai doc

Just fixed. It should change the next time docs are built

1 Like

As I mentioned earlier, Iā€™m not sure direct tests will always produce correct results and at times will send a user to a totally unrelated test, just because a test name happened to include a string that happened to be a function name. So I question whether those should be included at all.

So Iā€™d say at the very least put the related first, and direct last to increase relevance. Currently, it uses set, so the order will be lost and the following code from the last commit wonā€™t do that:

    other_tests = [get_links(t) for t in (direct+related)]
    other_tests = list(set(other_tests) - set(db_matches))

My suggestion is that since we do manual curation, letā€™s stick to showing less, but correct things, than more of maybe things, especially since one of the main purposes is to ask for more tests. So showing more isnā€™t necessarily a good thing, but this is not the issue.

As Iā€™m writing this Iā€™m realizing that direct tests shouldnā€™t be there in first place, since if we say ā€œOther tests where x is usedā€ we have no idea whether this is so for direct tests. If you can validate that the API is indeed used in testā€™s code and not as a substring or a comment, then itā€™s a good fit for ā€œothersā€, but if itā€™s not, then Iā€™d say it has little to no value.

But perhaps Iā€™m missing something, what value do you think direct tests could provide over manually curated tests plus other tests based on their API?

1 Like

Makes sense. Pushed an update with the new ordering.
Let me know if you want to remove direct tests alltogether

The idea behind ā€œdirect testsā€ is the hope that you wonā€™t have to manually enter ā€œthis_testsā€ and it will show up automatically - assuming the function is named right.
Something like: def test_DataBunch_create_and_oneitem - would show up for DataBunch, DataBunch.create and DataBunch.oneitem, but not for DataLoader.Create.

If itā€™s done correctly, we could remove all the 'this_tests"

1 Like

If we can do most off this dynamic itā€™s great, see also my remarks on surfacing the api usages on notebooks (other thread)

Yes, please.

The idea behind ā€œdirect testsā€ is the hope that you wonā€™t have to manually enter ā€œthis_testsā€ and it will show up automatically - assuming the function is named right.
Something like: def test_DataBunch_create_and_oneitem - would show up for DataBunch,
DataBunch.create and DataBunch.oneitem, but not for DataLoader.Create.
If itā€™s done correctly, we could remove all the 'this_tests"

Absolutely not. This will not work with identical method names from different classes. Plus many tests have multiple this_tests calls and multiple arguments, and often the test name has little to do with the API it tests, this happens when a certain scenario is tested and not just an API. Therefore, letā€™s not mix functionalities, so that tests can be named intuitively and not interfere with test registry needs.

And currently we require each test to have this_tests (albeit non-fatal). I personally donā€™t mind adding those calls, which helps me to get to know new tests that others write, if they didnā€™t do it already.

1 Like

What if we make this_tests a decorator before @pytest.mark.skip. Would that solve the merging problem?

we are on a (different) solution path: https://github.com/fastai/fastai/pull/1805

1 Like

What if we make this_tests a decorator before @pytest.mark.skip . Would that solve the merging problem?

No, because

  1. some tests skip from inside the test.
  2. this_tests needs to have access to objects which often donā€™t yet exist when entering the test function.
1 Like

A couple of updates:

  • merge_registries has been implemented with tests. This now allows us to run the registry update any time, and no more flags or conditions are needed. Iā€™ve removed all conditions, so any pytest run w/ a single or multiple tests will update the registry. I will be monitoring if it creates any unnecessary burden for devs.

    Every so often we should nuke the old registry, to get rid of any stale info.

  • I did a bunch of renames for consistency and ease of remembering, the main ones are:

    test_api_db.json => test_registry.json
    TestAPIRegistry  => TestRegistry
    

    so now we only need to remember 2 things: this_tests and test registry

Otherwise, everything looks good - contributors already start using this_test, thanks to the alerting feature Iā€™d imagine.

2 Likes

Great, thx. We need a Stas appreciation thread somewhere for sure!

1 Like