inspect4py icon indicating copy to clipboard operation
inspect4py copied to clipboard

Some scripts are tagged as tests when they should not

Open dgarijo opened this issue 4 years ago • 3 comments

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.

dgarijo avatar Sep 19 '21 17:09 dgarijo

Other repos to test this with: asciicinema, pyLODE, PyCG

dgarijo avatar Sep 19 '21 17:09 dgarijo

We could flag assert in non-tests as a bad practice.

dgarijo avatar Sep 24 '21 08:09 dgarijo

@rosafilgueira says that the function extract_relations can be used to address the first issue (see which files are imported in which)

dgarijo avatar Sep 24 '21 08:09 dgarijo