-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- repackage logger from hm_pyhelper.utils to hm_pyhelper.logger - LOGGER should be instantiated as uppercase by convention - add tests - add retry logic to get_region - create await_spi_available helper - fix override logic
- Loading branch information
1 parent
0432080
commit 7930aa2
Showing
9 changed files
with
106 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
class MalformedRegionException(Exception): | ||
pass | ||
|
||
|
||
class SPIUnavailableException(Exception): | ||
pass |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from unittest import TestCase | ||
from hm_pyhelper.logger import get_logger, _log_format | ||
import re | ||
import logging | ||
|
||
|
||
class TestLogger(TestCase): | ||
def test_get_logger(self): | ||
logger = get_logger(__name__) | ||
|
||
with self.assertLogs() as captured: | ||
logger.debug("Hello world.") | ||
|
||
# check that there is only one log message | ||
self.assertEqual(len(captured.records), 1) | ||
record = captured.records[0] | ||
formatter = logging.Formatter(_log_format) | ||
formatted_output = formatter.format(record) | ||
|
||
# Do not check timestamp and filepath because those change | ||
# based on the environment and run time | ||
expected_partial_output_regex = re.escape( | ||
" - [DEBUG] - hm_pyhelper.tests.test_logger -" + | ||
" (test_logger.py).test_get_logger -- ") | ||
expected_output_regex = ".*" + \ | ||
expected_partial_output_regex + ".*" + \ | ||
" - Hello world." | ||
are_logs_correct = re.search(expected_output_regex, formatted_output) | ||
self.assertTrue(are_logs_correct) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
|
||
setup( | ||
name='hm_pyhelper', | ||
version='0.8.4', | ||
version='0.8.9', | ||
author="Nebra Ltd", | ||
author_email="[email protected]", | ||
description="Helium Python Helper", | ||
|
@@ -12,7 +12,8 @@ | |
url="https://github.com/NebraLtd/hm-pyhelper", | ||
install_requires=[ | ||
'requests>=2.26.0', | ||
'jsonrpcclient==3.3.6' | ||
'jsonrpcclient==3.3.6', | ||
'retry==0.9.2' | ||
], | ||
project_urls={ | ||
"Bug Tracker": "https://github.com/NebraLtd/hm-pyhelper/issues", | ||
|