CI Tests: additional report testing
This commit is contained in:
parent
2ac7c5baa7
commit
e571a35e26
@ -92,6 +92,13 @@ def dynamic_method(report_name, test_function,
|
|||||||
return test_method
|
return test_method
|
||||||
|
|
||||||
class TestDynamic(unittest.TestCase):
|
class TestDynamic(unittest.TestCase):
|
||||||
|
@classmethod
|
||||||
|
def setUpClass(cls):
|
||||||
|
try:
|
||||||
|
os.makedirs("temp")
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def call(cls, *args):
|
def call(cls, *args):
|
||||||
print("call:", args)
|
print("call:", args)
|
||||||
@ -112,9 +119,11 @@ def report_contains(text):
|
|||||||
with open(report_name + "." + ext) as fp:
|
with open(report_name + "." + ext) as fp:
|
||||||
contents = fp.read()
|
contents = fp.read()
|
||||||
print(contents)
|
print(contents)
|
||||||
os.remove(report_name + "." + ext)
|
if options.get("files", []):
|
||||||
for filename in options.get("files", []):
|
for filename in options.get("files", []):
|
||||||
os.remove(filename)
|
os.remove(filename)
|
||||||
|
else:
|
||||||
|
os.remove(report_name + "." + ext)
|
||||||
return text in contents
|
return text in contents
|
||||||
return test_output_file
|
return test_output_file
|
||||||
|
|
||||||
@ -122,9 +131,11 @@ def err_does_not_contain(text):
|
|||||||
def test_output_file(out, err, report_name, **options):
|
def test_output_file(out, err, report_name, **options):
|
||||||
ext = options["off"]
|
ext = options["off"]
|
||||||
print(err)
|
print(err)
|
||||||
os.remove(report_name + "." + ext)
|
if options.get("files", []):
|
||||||
for filename in options.get("files", []):
|
for filename in options.get("files", []):
|
||||||
os.remove(filename)
|
os.remove(filename)
|
||||||
|
else:
|
||||||
|
os.remove(report_name + "." + ext)
|
||||||
return text not in err
|
return text not in err
|
||||||
return test_output_file
|
return test_output_file
|
||||||
|
|
||||||
@ -133,9 +144,17 @@ reports.addtest(TestDynamic, "tag_report",
|
|||||||
[],
|
[],
|
||||||
off="txt", tag="tag1")
|
off="txt", tag="tag1")
|
||||||
|
|
||||||
#reports.addtest(TestDynamic, "navwebpage",
|
reports.addtest(TestDynamic, "navwebpage",
|
||||||
# err_does_not_contain("Failed to write report."),
|
err_does_not_contain("Failed to write report."),
|
||||||
# off="html")
|
["temp/download.html",
|
||||||
|
"temp/individuals.html",
|
||||||
|
"temp/places.html",
|
||||||
|
"temp/surnames_count.html",
|
||||||
|
"temp/index.html",
|
||||||
|
"temp/media.html",
|
||||||
|
"temp/sources.html",
|
||||||
|
"temp/thumbnails.html"],
|
||||||
|
off="html", target="temp")
|
||||||
|
|
||||||
### Three hashes: capture out/err seems to conflict with Travis/nose proxy:
|
### Three hashes: capture out/err seems to conflict with Travis/nose proxy:
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user