Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
binary_c-python
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Izzard, Robert Dr (Maths & Physics)
binary_c-python
Commits
9c75c51a
Commit
9c75c51a
authored
3 years ago
by
dh00601
Browse files
Options
Downloads
Patches
Plain Diff
working on splitting the custom logging unit tests
parent
44070db2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
binarycpython/tests/main.py
+9
-4
9 additions, 4 deletions
binarycpython/tests/main.py
binarycpython/tests/test_custom_logging.py
+27
-3
27 additions, 3 deletions
binarycpython/tests/test_custom_logging.py
with
36 additions
and
7 deletions
binarycpython/tests/main.py
+
9
−
4
View file @
9c75c51a
# /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 *
...
...
This diff is collapsed.
Click to expand it.
binarycpython/tests/test_custom_logging.py
+
27
−
3
View file @
9c75c51a
...
...
@@ -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
modul
e
Unit test
class for autogen_C
_logging
_cod
e
"""
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
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment