diff -r eab09a1ab8ce -r 8d3ae97ee666 eric7/Project/Project.py --- a/eric7/Project/Project.py Tue May 17 17:23:07 2022 +0200 +++ b/eric7/Project/Project.py Wed May 18 08:43:36 2022 +0200 @@ -5068,18 +5068,13 @@ " current project. Aborting")) return - tfn = Utilities.getTestFileName(fn) - basename = os.path.splitext(fn)[0] - tbasename = os.path.splitext(tfn)[0] - # determine name of coverage file to be used files = [] - f = "{0}.coverage".format(basename) - tf = "{0}.coverage".format(tbasename) - if os.path.isfile(f): - files.append(f) - if os.path.isfile(tf): - files.append(tf) + for filename in [fn] + Utilities.getTestFileNames(fn): + basename = os.path.splitext(filename)[0] + f = "{0}.coverage".format(basename) + if os.path.isfile(f): + files.append(f) if files: if len(files) > 1: @@ -5118,18 +5113,13 @@ " current project. Aborting")) return - tfn = Utilities.getTestFileName(fn) - basename = os.path.splitext(fn)[0] - tbasename = os.path.splitext(tfn)[0] - # determine name of profile file to be used files = [] - f = "{0}.profile".format(basename) - tf = "{0}.profile".format(tbasename) - if os.path.isfile(f): - files.append(f) - if os.path.isfile(tf): - files.append(tf) + for filename in [fn] + Utilities.getTestFileNames(fn): + basename = os.path.splitext(filename)[0] + f = "{0}.profile".format(basename) + if os.path.isfile(f): + files.append(f) if files: if len(files) > 1: @@ -5157,16 +5147,18 @@ """ fn = self.getMainScript(True) if fn is not None: - tfn = Utilities.getTestFileName(fn) - basename = os.path.splitext(fn)[0] - tbasename = os.path.splitext(tfn)[0] - self.codeProfileAct.setEnabled( - os.path.isfile("{0}.profile".format(basename)) or - os.path.isfile("{0}.profile".format(tbasename))) + filenames = [os.path.splitext(f)[0] + for f in [fn] + Utilities.getTestFileNames(fn)] + self.codeProfileAct.setEnabled(any([ + os.path.isfile("{0}.profile".format(f)) + for f in filenames + ])) self.codeCoverageAct.setEnabled( - self.isPy3Project() and - (os.path.isfile("{0}.coverage".format(basename)) or - os.path.isfile("{0}.coverage".format(tbasename)))) + self.isPy3Project() and any([ + os.path.isfile("{0}.coverage".format(f)) + for f in filenames + ]) + ) else: self.codeProfileAct.setEnabled(False) self.codeCoverageAct.setEnabled(False)