inspect4py
inspect4py copied to clipboard
Some scripts are tagged as tests when they should not
Right now we check if the assert commands are used in tests.
I have detected some places (e.g., repo Tface) where the assert expressions are used just to check if the inputs to the script are correct. This is not a good practice, but we should not assume that any function with assert is a test. Alternatives:
- Check if any of the imports include the test frameworks.
- Check if the assert functions are the last call in the target function. This way, we'll know it is a test instead of asserting a in input condition.
Other repos to test this with: asciicinema, pyLODE, PyCG
We could flag assert in non-tests as a bad practice.
@rosafilgueira says that the function extract_relations can be used to address the first issue (see which files are imported in which)