Merge pull request #5360 from SpecLad:test2-fail-on-failed-download
This commit is contained in:
commit
e1b0d341e4
@ -2,17 +2,8 @@
|
||||
|
||||
import unittest
|
||||
import random
|
||||
import time
|
||||
import math
|
||||
import sys
|
||||
import array
|
||||
import urllib
|
||||
import tarfile
|
||||
import urllib2
|
||||
import hashlib
|
||||
import os
|
||||
import getopt
|
||||
import operator
|
||||
import functools
|
||||
import numpy as np
|
||||
import cv2
|
||||
import cv2.cv as cv
|
||||
@ -21,8 +12,10 @@ class NewOpenCVTests(unittest.TestCase):
|
||||
|
||||
def get_sample(self, filename, iscolor = cv.CV_LOAD_IMAGE_COLOR):
|
||||
if not filename in self.image_cache:
|
||||
filedata = urllib.urlopen("https://raw.github.com/Itseez/opencv/2.4/" + filename).read()
|
||||
self.image_cache[filename] = cv2.imdecode(np.fromstring(filedata, dtype=np.uint8), iscolor)
|
||||
filedata = urllib2.urlopen("https://raw.github.com/Itseez/opencv/2.4/" + filename).read()
|
||||
image = cv2.imdecode(np.fromstring(filedata, dtype=np.uint8), iscolor)
|
||||
self.assertFalse(image is None)
|
||||
self.image_cache[filename] = image
|
||||
return self.image_cache[filename]
|
||||
|
||||
def setUp(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user