Skip to content

Conversation

RasmusWL
Copy link
Member

I found an old evaluation on LGTM for comparing the difference. Overall it looks good 👍

One improvement is that the old modeling would also flag custom test runners (subclasses of unittest.TextTestRunner) and test loaders (subclasses of unittest.TestLoader). Although these are related to testing, they are certainly not a unit test class ;)

The new modeling captures quite a lot of new real testcases, from subclasses such as

  • from flask_testing import TestCase, LiveServerTestCase
  • from nose.plugins import doctests as npd; npd.DocTestCase
  • tornado.testing.AsyncHTTPTestCase
  • from django.test import TestCase

Overall I think this looks like an improvement in behavior for our test-detection, although it isn't used for as much with Code Scanning as it was for LGTM. It also moves us away from points-to. Seems like a win-win to me 😊

RasmusWL added 2 commits May 30, 2022 14:11
With no virtual environment enabled, none of the third-party library
test case are found.
Notice that although we loose the contrived examples in `test.py`, we do
gain support for real-world test-case construction, which seems worth
the tradeoff.
@RasmusWL RasmusWL added the no-change-note-required This PR does not need a change note label May 30, 2022
@RasmusWL RasmusWL requested a review from a team as a code owner May 30, 2022 12:14
Copy link
Contributor

@tausbn tausbn left a comment

Choose a reason for hiding this comment

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

One question, otherwise this looks good to me. 👍

Comment on lines -1 to -3
| test.py:4:1:4:23 | Class MyTest |
| test.py:6:5:6:21 | Function test_1 |
| test.py:9:5:9:21 | Function test_2 |
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the fact that these are no longer matched intended? If so, then maybe we should just get rid of test.py entirely?

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah I noted in a8b4b6a:

Notice that although we loose the contrived examples in test.py, we do
gain support for real-world test-case construction, which seems worth
the tradeoff.

I think I'll delete that file 👍

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah! I didn't see that commit message. Thanks!

@RasmusWL RasmusWL merged commit b6cc438 into github:main May 30, 2022
@RasmusWL RasmusWL deleted the test-model-api-graphs branch May 30, 2022 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-change-note-required This PR does not need a change note Python
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants