Skip to content

Commit

Permalink
CU-8694wh3d5: Rename usage monitoring environmental variables to be m…
Browse files Browse the repository at this point in the history
…ore desciptive
  • Loading branch information
mart-r committed Jul 18, 2024
1 parent 166d933 commit 6dcaf70
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions medcat/utils/usage_monitoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
from medcat.config import UsageMonitor as UsageMonitorConfig


LOGS_ENV = "MEDCAT_LOGS"
LOGS_LOC_ENV = "MEDCAT_LOGS_LOCATION"
LOGS_ENV = "MEDCAT_USAGE_LOGS"
LOGS_LOC_ENV = "MEDCAT_USAGE_LOGS_LOCATION"

DEFAULT_LOGS_WINDOWS = os.path.join(os.environ.get('APPDATA', "NOT WINDOWS"), 'medcat', 'logs')
DEFAULT_LOGS_LINUX = os.path.expanduser("~/.local/share/medcat/logs/")
Expand Down
14 changes: 7 additions & 7 deletions tests/utils/test_usage_monitoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,16 @@ def test_some_in_file(self):

class UMT(UsageMonitorBaseTests):
ENABLED_DICT = {
"MEDCAT_LOGS": "True",
"MEDCAT_LOGS_LOCATION": "."
"MEDCAT_USAGE_LOGS": "True",
"MEDCAT_USAGE_LOGS_LOCATION": "."
}
DISABLED_DICT_1 = {
"MEDCAT_LOGS": "False",
"MEDCAT_LOGS_LOCATION": "FAIL" # should not change anything
"MEDCAT_USAGE_LOGS": "False",
"MEDCAT_USAGE_LOGS_LOCATION": "FAIL" # should not change anything
}
DISABLED_DICT_2 = {
"MEDCAT_LOGS": "0",
"MEDCAT_LOGS_LOCATION": "."
"MEDCAT_USAGE_LOGS": "0",
"MEDCAT_USAGE_LOGS_LOCATION": "."
}

def setUp(self) -> None:
Expand All @@ -114,7 +114,7 @@ def setUp(self) -> None:
def test_listens_to_os_environ_enabled(self):
self.assertTrue(self.monitor._should_log())
self.assertNotEqual(self.config.log_folder, self._temp_dir.name)
self.assertEqual(self.config.log_folder, self.ENABLED_DICT["MEDCAT_LOGS_LOCATION"])
self.assertEqual(self.config.log_folder, self.ENABLED_DICT["MEDCAT_USAGE_LOGS_LOCATION"])

@patch.dict(os.environ, DISABLED_DICT_1)
def test_listens_to_os_environ_disabled_1(self):
Expand Down

0 comments on commit 6dcaf70

Please sign in to comment.