Commit 163ebbc2 authored by Denis Laxalde's avatar Denis Laxalde
Browse files

Possibly check the value of stdout in ccplugin tests

We handle a keyword argument 'stdout_check' in run_import_skos() test
helper and use its value to compare with process stdout. This will be
used in the next changeset.
parent b416ffb23a2c
...@@ -50,12 +50,15 @@ class ImportSkosDataCommandTC(testlib.CubicWebTC): ...@@ -50,12 +50,15 @@ class ImportSkosDataCommandTC(testlib.CubicWebTC):
CubicWebConfiguration.config_for = self.orig_config_for CubicWebConfiguration.config_for = self.orig_config_for
super(ImportSkosDataCommandTC, self).tearDown() super(ImportSkosDataCommandTC, self).tearDown()
def run_import_skos(self, fpath, *args): def run_import_skos(self, fpath, *args, **kwargs):
cmd = [self.appid, fpath] + list(args) cmd = [self.appid, fpath] + list(args)
sys.stdout = StringIO() sys.stdout = StringIO()
try: try:
ccplugin.ImportSkosData(None).main_run(cmd) ccplugin.ImportSkosData(None).main_run(cmd)
finally: finally:
stdout_check = kwargs.pop('stdout_check', None)
if stdout_check is not None:
self.assertIn(stdout_check, sys.stdout.getvalue())
sys.stdout = sys.__stdout__ sys.stdout = sys.__stdout__
def _test_base(self): def _test_base(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