comparison mx/commands.py @ 10608:eeb80dcd60d8

fixed regression in unittest command when no tests are specified
author Doug Simon <doug.simon@oracle.com>
date Thu, 04 Jul 2013 15:30:38 +0200
parents a6c0ae38e05e
children 050eba23554e
comparison
equal deleted inserted replaced
10607:dd5a042811f6 10608:eeb80dcd60d8
713 for s in substrings: 713 for s in substrings:
714 if s in c: 714 if s in c:
715 return True 715 return True
716 return False 716 return False
717 717
718 if len(tests) == 0:
719 mx.abort('no tests specified')
720
721 candidates = [] 718 candidates = []
722 for p in mx.projects(): 719 for p in mx.projects():
723 if mx.java().javaCompliance < p.javaCompliance: 720 if mx.java().javaCompliance < p.javaCompliance:
724 continue 721 continue
725 candidates += _find_classes_with_annotations(p, None, annotations).keys() 722 candidates += _find_classes_with_annotations(p, None, annotations).keys()
726 723
727 classes = [] 724 classes = []
728 for t in tests: 725 if len(tests) == 0:
729 if t.startswith('-'): 726 classes = candidates
730 mx.abort('VM option needs @ prefix (i.e., @' + t + ')') 727 else:
731 728 for t in tests:
732 found = False 729 if t.startswith('-'):
733 for c in candidates: 730 mx.abort('VM option needs @ prefix (i.e., @' + t + ')')
734 if t in c: 731
735 found = True 732 found = False
736 classes.append(c) 733 for c in candidates:
737 if not found: 734 if t in c:
738 mx.log('warning: no tests matched by substring "' + t) 735 found = True
736 classes.append(c)
737 if not found:
738 mx.log('warning: no tests matched by substring "' + t)
739 739
740 projectscp = mx.classpath([pcp.name for pcp in mx.projects() if pcp.javaCompliance <= mx.java().javaCompliance]) 740 projectscp = mx.classpath([pcp.name for pcp in mx.projects() if pcp.javaCompliance <= mx.java().javaCompliance])
741 741
742 if len(classes) != 0: 742 if len(classes) != 0:
743 f_testfile = open(testfile, 'w') 743 f_testfile = open(testfile, 'w')