Commit e1b0d341 authored by Alexander Alekhin's avatar Alexander Alekhin

Merge pull request #5360 from SpecLad:test2-fail-on-failed-download

parents fb4b4cbf 08ad3b50
...@@ -2,17 +2,8 @@ ...@@ -2,17 +2,8 @@
import unittest import unittest
import random import random
import time import urllib2
import math
import sys
import array
import urllib
import tarfile
import hashlib import hashlib
import os
import getopt
import operator
import functools
import numpy as np import numpy as np
import cv2 import cv2
import cv2.cv as cv import cv2.cv as cv
...@@ -21,8 +12,10 @@ class NewOpenCVTests(unittest.TestCase): ...@@ -21,8 +12,10 @@ class NewOpenCVTests(unittest.TestCase):
def get_sample(self, filename, iscolor = cv.CV_LOAD_IMAGE_COLOR): def get_sample(self, filename, iscolor = cv.CV_LOAD_IMAGE_COLOR):
if not filename in self.image_cache: if not filename in self.image_cache:
filedata = urllib.urlopen("https://raw.github.com/Itseez/opencv/2.4/" + filename).read() filedata = urllib2.urlopen("https://raw.github.com/Itseez/opencv/2.4/" + filename).read()
self.image_cache[filename] = cv2.imdecode(np.fromstring(filedata, dtype=np.uint8), iscolor) 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] return self.image_cache[filename]
def setUp(self): def setUp(self):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment