We too would like to automatically skip some tests, but only for those that have no previous result (some linacs that share testlists have different energies, and those tests have never been ran for that machine). Would there be anything wrong with using it this way? In this case, our test macro name is reading1_6mv. Thanks!
from qatrack.qa.models import TestInstance
instances = TestInstance.objects.filter(
unit_test_info__test_id=28, # replace with your test_id,
unit_test_info__unit__number=META[
"unit_number"
], # limit to results from current unit
test_list_instance__work_completed__lte=META[
"work_started"
], # limit results to prior dates
test_list_instance__in_progress=False, # exclude in progress results
status__valid=True, # exclude any invalid data
skipped=False, # exclude skipped results
)
try:
latest = instances.latest("work_completed") # get most recent result
reading1_6mv = None
except TestInstance.DoesNotExist:
reading1_6mv = None
UTILS.set_skip("reading1_6mv", True)