summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2012-01-15 19:47:04 +0100
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2012-01-15 19:47:04 +0100
commit5981d85ce8ee86ac03afb129511aff5498b08b37 (patch)
tree7a3973bfa1b385f379d3757366997ece382189c9 /tests
parentconfig directory fix (diff)
downloadpyload-5981d85ce8ee86ac03afb129511aff5498b08b37.tar.xz
keep downloaded files for debug report
Diffstat (limited to 'tests')
-rw-r--r--tests/HosterPluginTester.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/tests/HosterPluginTester.py b/tests/HosterPluginTester.py
index bc802ec18..f9ca74e5f 100644
--- a/tests/HosterPluginTester.py
+++ b/tests/HosterPluginTester.py
@@ -1,12 +1,11 @@
# -*- coding: utf-8 -*-
-import __main__
-
from os import remove
from os.path import dirname
from logging import log, DEBUG
from hashlib import md5
from time import time
+from shutil import move
from nose.tools import nottest
@@ -16,7 +15,7 @@ from helper.PluginTester import PluginTester
from module.PyFile import PyFile
from module.plugins.Base import Fail
from module.utils import accumulate
-from module.utils.fs import save_join, join, exists
+from module.utils.fs import save_join, join, exists, listdir
DL_DIR = join("Downloads", "tmp")
@@ -29,6 +28,12 @@ class HosterPluginTester(PluginTester):
pass
if exists(join(DL_DIR, f)): remove(join(DL_DIR, f))
+ # folder for reports
+ report = join("tmp", self.__class__.__name__)
+ if exists(report):
+ for f in listdir(report):
+ remove(join(report, f))
+
@nottest
def test_plugin(self, name, url, flag):
@@ -65,9 +70,14 @@ class HosterPluginTester(PluginTester):
buf = f.read(4096)
if not buf: break
hash.update(buf)
+ f.close()
if hash.hexdigest() != self.files[pyfile.name]:
log(DEBUG, "Hash is %s" % hash.hexdigest())
+
+ # Copy for debug report
+ move(f.name, join("tmp", plugin, f.name))
+
raise Exception("Hash does not match.")