Fakultas Ilmu Komputer UI

Skip to content

Fix django-nose bug to make models and serializers coverage read by SonarQube (#198)

Ichlasul Affan requested to merge 1606895606-198 into master

The expected behaviour of Django test is loading the models and serializers first, so the coverage should be 100% for them except there are some other implementations (e.g. To String definition, model methods, custom save/delete, validators, or path getter for file upload). So, I've tried three approaches to workaround django-nose bug and achieving that:

  1. Use coverage on GitLab CI while maintaining the django_nose settings, FAILED (both Windows and Linux).
  2. Import coverage library via manage.py and dropping --with-coverage setting for django_nose, SUCCESS on Windows (coverage 90%, models/serializers no longer 0%), FAILED on Linux
  3. DROPPING django-nose from requirements and use the standard unittest library, with coverage import still in manage.py to maintain existing workflow. SUCCESS on both Windows and Linux (coverage 90%, models/serializers no longer 0%), but at the expense of losing stdout grouping for each tests, making it harder to debug tests in general. This is the latest one I used right now.

Closes #198 (closed).

Edited by Ichlasul Affan

Merge request reports