Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overwrite error_log_func #8

Merged
merged 1 commit into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/genie_python/genie_epics_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def __init__(
else:
self._environment_details = environment_details

Wrapper.errorLogFunc = self.logger.log_ca_msg
Wrapper.error_log_func = self.logger.log_ca_msg

# disable CA error messages to console from disconnected PVs
import ctypes
Expand Down
3 changes: 3 additions & 0 deletions tests/test_genie_epics_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@ def test_GIVEN_pv_name_WHEN_pv_not_connected_THEN_get_pv_alarm(self):

self.assertEqual(self.api.get_pv_alarm("DISCONNECTED_PV"), "UNKNOWN")

def test_GIVEN_api_is_imported_THEN_error_log_func_overwritten_on_wrapper(self):
self.assertEqual(self.mock_wrapper.error_log_func, self.api.logger.log_ca_msg)


class TestEpicsApiSetInstrumentName(unittest.TestCase):
def setUp(self):
Expand Down