physionet-build icon indicating copy to clipboard operation
physionet-build copied to clipboard

Test suite leaving behind 'training-report.pdf' files

Open bemoody opened this issue 1 year ago • 0 comments

One of the test cases is generating files under media/test and not cleaning them up afterwards:

$ ./manage.py test
[...]
$ find ../media/test/
../media/test/
../media/test/training
../media/test/training/training-report.pdf
../media/test/training/mdudMcv1nv6LroMtnLdp
../media/test/training/mdudMcv1nv6LroMtnLdp/training-report.pdf

I'm guessing this is a recent change?

It's not a huge issue, but:

  1. If a test case requires creating files, in media/test or elsewhere, then those files should be deleted by tearDown. An easy way to handle this is for the TestCase class to inherit from user.test_views.TestMixin (as most of the project tests do.) (Granted, the TestMixin class could be better named, better documented, and is overkill in many cases.)

  2. media/test should be ignored by .gitignore

bemoody avatar Jan 03 '23 21:01 bemoody