Skip to content
Snippets Groups Projects
Commit 9c75c51a authored by dh00601's avatar dh00601
Browse files

working on splitting the custom logging unit tests

parent 44070db2
No related branches found
No related tags found
No related merge requests found
# /usr/bin/env python
"""
Main file for the tests. This file imports all the combined_test functions from all files.
TODO: fix the imports without the wildcard
Main file for the tests. This file imports all the unit test functions from all modules except for the notebooks and for the HPC functions
"""
import unittest
......@@ -12,7 +10,14 @@ from binarycpython.tests.test_c_bindings import (
test_return_store_memaddr,
TestEnsemble,
)
# from binarycpython.tests.test_custom_logging import *
from binarycpython.tests.test_custom_logging import (
test_autogen_C_logging_code,
test_binary_c_log_code,
test_binary_c_write_log_code,
test_from_binary_c_config,
test_return_compilation_dict,
test_create_and_load_logging_function
)
# from binarycpython.tests.test_distributions import *
# from binarycpython.tests.test_functions import *
# from binarycpython.tests.test_grid import *
......
......@@ -10,9 +10,9 @@ from binarycpython.utils.functions import Capturing
TMP_DIR = temp_dir("tests", "test_custom_logging")
class test_custom_logging(unittest.TestCase):
class test_autogen_C_logging_code(unittest.TestCase):
"""
Unit test for the custom_logging module
Unit test class for autogen_C_logging_code
"""
def test_autogen_C_logging_code(self):
......@@ -48,6 +48,11 @@ class test_custom_logging(unittest.TestCase):
output_3 = autogen_C_logging_code(input_dict_3, verbosity=1)
self.assertEqual(output_3, None, msg="Output should be None")
class test_binary_c_log_code(unittest.TestCase):
"""
Unit test for binary_c_log_code
"""
def test_binary_c_log_code(self):
with Capturing() as output:
self._test_binary_c_log_code()
......@@ -72,6 +77,11 @@ class test_custom_logging(unittest.TestCase):
msg="Output does not match what it should be: {}".format(test_value_2),
)
class test_binary_c_write_log_code(unittest.TestCase):
"""
Unit test for binary_c_write_log_code
"""
def test_binary_c_write_log_code(self):
with Capturing() as output:
self._test_binary_c_write_log_code()
......@@ -98,6 +108,11 @@ class test_custom_logging(unittest.TestCase):
content_file = repr(f.read())
self.assertEqual(repr(input_1), content_file, msg="Contents are not similar")
class test_from_binary_c_config(unittest.TestCase):
"""
Unit test for from_binary_c_config
"""
def test_from_binary_c_config(self):
with Capturing() as output:
self._test_from_binary_c_config()
......@@ -131,6 +146,11 @@ class test_custom_logging(unittest.TestCase):
msg="binary_c version doesnt match",
)
class test_return_compilation_dict(unittest.TestCase):
"""
Unit test for return_compilation_dict
"""
def test_return_compilation_dict(self):
with Capturing() as output:
self._test_return_compilation_dict()
......@@ -152,6 +172,11 @@ class test_custom_logging(unittest.TestCase):
self.assertTrue("libs" in output)
self.assertTrue("inc" in output)
class test_create_and_load_logging_function(unittest.TestCase):
"""
Unit test for return_compilation_dict
"""
def test_create_and_load_logging_function(self):
with Capturing() as output:
self._test_create_and_load_logging_function()
......@@ -173,6 +198,5 @@ class test_custom_logging(unittest.TestCase):
msg="Name of the libcustom_logging not correct",
)
if __name__ == "__main__":
unittest.main()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment