mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-04-25 12:56:22 +02:00
[plotting] tests now working?
This commit is contained in:
parent
0402cf98e9
commit
bd128cfa8c
101 changed files with 29 additions and 115166 deletions
|
|
@ -31,6 +31,7 @@ import numpy as np
|
|||
import GPy, os, sys
|
||||
from nose import SkipTest
|
||||
import unittest
|
||||
from matplotlib.testing.compare import compare_images
|
||||
|
||||
try:
|
||||
from matplotlib import cbook, pyplot as plt
|
||||
|
|
@ -39,7 +40,7 @@ try:
|
|||
except:
|
||||
raise SkipTest("Matplotlib not installed, not testing plots")
|
||||
|
||||
extensions = ['svg', 'pdf']
|
||||
extensions = ['png', 'pdf']
|
||||
|
||||
def _image_directories(func):
|
||||
"""
|
||||
|
|
@ -89,12 +90,15 @@ class test_image_comparison(object):
|
|||
fig.set_frameon(False)
|
||||
fig.savefig(os.path.join(self.result_dir, "{}.{}".format(base, ext)), frameon=False)
|
||||
print os.path.join(self.result_dir, "{}.{}".format(base, ext))
|
||||
with open(os.path.join(self.result_dir, "{}.{}".format(base, ext)), 'r') as f:
|
||||
try:
|
||||
with open(os.path.join(self.baseline_dir, "{}.{}".format(base, ext)), 'r') as b:
|
||||
yield sequenceEqual, f.read(), b.read()
|
||||
except:
|
||||
yield notFound, os.path.join(self.baseline_dir, "{}.{}".format(base, ext))
|
||||
actual = os.path.join(self.result_dir, "{}.{}".format(base, ext))
|
||||
expected = os.path.join(self.baseline_dir, "{}.{}".format(base, ext))
|
||||
yield compare_images, actual, expected, 1e-3
|
||||
plt.close('all')
|
||||
#with open(os.path.join(self.result_dir, "{}.{}".format(base, ext)), 'r') as f:
|
||||
# try:
|
||||
# with open(os.path.join(self.baseline_dir, "{}.{}".format(base, ext)), 'r') as b:
|
||||
# except:
|
||||
# yield notFound, os.path.join(self.baseline_dir, "{}.{}".format(base, ext))
|
||||
#plt.close(num)
|
||||
|
||||
return test_wrap
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue