Commit cadd6857 authored by Baptiste CHOCOT's avatar Baptiste CHOCOT
Browse files

Update tests

parent d6b61cc0
Pipeline #177300 failed with stage
MAKE=make
check:
@(echo "** Linting **\n")
(pycodestyle test/**/*.py diva_evaluation_cli/bin/)
@(echo "** Running UnitTests **\n")
(python3 -m unittest test/test_*/*.py)
\ No newline at end of file
......@@ -116,7 +116,10 @@ class ActevCommand():
except KeyboardInterrupt:
logging.info("Ctrl-C detected. Exiting.")
sys.exit(0)
except Exception:
logging.exception("Issue during %s" % self.command)
StatusFactory.generate_status(self, 'issue', args.__dict__)
sys.exit(1)
except Exception as e:
# Necessary for testing purposes
if not isinstance(e, NotImplementedError):
logging.exception("Issue during %s" % self.command)
StatusFactory.generate_status(self, 'issue', args.__dict__)
sys.exit(1)
raise NotImplementedError
'''
This module implements unit tests of the actev clear-logs command.
'''
import sys
import unittest
from diva_evaluation_cli.bin.cli import cli_parser
class TestClearLogs(unittest.TestCase):
"""
Test the actev clear-logs command.
"""
def test_clear_logs(self):
sys.argv = [sys.argv[0], 'clear-logs']
try:
cli_parser()
except Exception:
self.fail('`actev clear-logs` failed.')
if __name__ == '__main__':
unittest.main()
{
"example_video_0.mp4": {},
"example_video_1.mp4": {},
"example_video_2.mp4": {}
}
\ No newline at end of file
'''
This module implements unit tests of the actev expriment-init command.
'''
import sys
import os
import unittest
from diva_evaluation_cli.bin.cli import cli_parser
cdir = os.path.dirname(os.path.abspath(__file__))
res = os.path.join(cdir, "resources")
class TestExperimentInit(unittest.TestCase):
"""
Test the actev experiment-init command.
"""
def setUp(self):
self.file_index = os.path.join(res, "file-index.json")
self.activity_index = os.path.join(res, "activity-index.json")
self.chunks = os.path.join(res, "chunks.json")
self.video_location = os.path.join(res, "videos")
self.system_cache = os.path.join(cdir, "system_cache")
self.config = os.path.join(res, "config.yml")
def test_experiment_init(self):
sys.argv[1:] = ["experiment-init", "-f", self.file_index, "-a",
self.activity_index, "-c", self.chunks, "-v",
self.video_location, "-s", self.system_cache]
try:
cli_parser()
except Exception as e:
if not isinstance(e, NotImplementedError):
self.fail('`actev experiment-init` failed.')
def test_experiment_init_config(self):
sys.argv.extend(["-c", self.config])
try:
cli_parser()
except Exception as e:
if not isinstance(e, NotImplementedError):
self.fail('`actev experiment-init` with config failed.')
if __name__ == '__main__':
unittest.main()
# -*- coding: utf-8 -*-
'''
This module implements unit tests of the actev get-system command.
This module implements unit tests of the actev get-system command.
'''
import sys
import os
import shutil
import unittest
import argparse
from diva_evaluation_cli.bin.cli import cli_parser
......
'''
This module implements unit tests of the actev status command.
'''
import sys
import os
import unittest
from diva_evaluation_cli.bin.cli import cli_parser
cdir = os.path.dirname(os.path.abspath(__file__))
res = os.path.join(cdir, "resources")
class TestStatus(unittest.TestCase):
"""
Test the actev status command.
"""
def setUp(self):
sys.argv[1:] = ["status"]
def _test_cli(error_msg):
try:
cli_parser()
except Exception:
self.fail(error_msg)
def test_status_chunk_query(self):
chunk_id = 0
sys.argv.extend(["chunk-query", "-i", chunk_id])
_test_cli('`actev status chunk-query` failed.')
def test_status_experiment_query(self):
sys.argv.append("experiment-query")
_test_cli('`actev status experiment-query` failed.')
def test_status_system_query(self):
sys.argv.append("system-query")
_test_cli('`actev status system-query` failed.')
if __name__ == '__main__':
unittest.main()
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