Skip to content
Snippets Groups Projects
Commit 379f9725 authored by Omid Hosseini's avatar Omid Hosseini
Browse files

Add the structure of the unittest to util module

parent 8585862e
No related tags found
No related merge requests found
Pipeline #1058 failed with stage
in 45 seconds
import unittest
from unittest.mock import patch
from baler_addr import util
class TestUtil(unittest.TestCase):
@classmethod
def setUpClass(cls) -> None:
print('setupClass.')
@classmethod
def tearDownClass(cls) -> None:
print('teardownClass.')
def setUp(self) -> None:
print('setup.')
pass
def tearDown(self) -> None:
print('teardown.\n')
pass
def test_retrieve_baler_dir_list(self):
pass
def test_clear_baler_status(self):
pass
def test_retrieve_baler_thrd_status(self):
pass
def test_retrieve_baler_status(self):
pass
def test_retrieve_baler_info(self):
pass
def test_find_occur(self):
pass
def test_get_htm(self):
pass
def test_check_tags(self):
pass
def test_query_yes_no(self):
pass
def test_user_decision_tags(self):
pass
def test_mkdir_p(self):
pass
...@@ -282,8 +282,8 @@ def user_decision_tags(missing_tags, extra_tags): ...@@ -282,8 +282,8 @@ def user_decision_tags(missing_tags, extra_tags):
# The user has entered tagIDs that don't match with the identified # The user has entered tagIDs that don't match with the identified
# ones. Report them and ask for the proper action. # ones. Report them and ask for the proper action.
if len(missing_tags) != 0: if len(missing_tags) != 0:
logger.warning("Devices with the following tag(s), %s, not identified" logger.warning("Devices with the following tag(s), %s, not identified",
, missing_tags) missing_tags)
print("Baler(s) with following tag(s), %s, have not been " print("Baler(s) with following tag(s), %s, have not been "
"addressed. (Not connected perhaps!)." % missing_tags) "addressed. (Not connected perhaps!)." % missing_tags)
if query_yes_no("Would you like to connect the Baler(s) with the " if query_yes_no("Would you like to connect the Baler(s) with the "
...@@ -315,7 +315,8 @@ def mkdir_p(path): ...@@ -315,7 +315,8 @@ def mkdir_p(path):
except TypeError: except TypeError:
try: try:
os.makedirs(path) os.makedirs(path)
except OSError as exc: # Python >2.5 # Python > 2.5
except OSError as exc:
if exc.errno == errno.EEXIST and os.path.isdir(path): if exc.errno == errno.EEXIST and os.path.isdir(path):
pass pass
else: else:
......
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