Skip to content

Commit

Permalink
ENH #1854: Tests will check for alternate baselines using basename_[1…
Browse files Browse the repository at this point in the history
…-9].ext

Previously the pattern used was baseline.*\.ext
  • Loading branch information
danlipsa committed Apr 21, 2016
1 parent de21daf commit e9bc399
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion testing/checkimage.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import vtk
import os
import os.path
import re
import sys
import logging

Expand Down Expand Up @@ -40,13 +41,15 @@ def image_from_file(fname):
print "Problem opening file '%s': %s"%(fname,err)
return None

# find alternate baselines for fname of the form basename_d.ext
# where fname = basename.ext and d is a digit between 1 and 9
def find_alternates(fname):
dirname = os.path.dirname(fname)
prefix, ext = os.path.splitext(os.path.split(fname)[1])
files = os.listdir(dirname)
results = [fname]
for i in files:
if i.startswith(prefix) and i.endswith(ext) and i != prefix+ext:
if (re.match(prefix + '_[1-9]' + ext, i)):
results.append(os.path.join(dirname, i))
return results

Expand Down

0 comments on commit e9bc399

Please sign in to comment.