Skip to content

Commit

Permalink
Merge branch 'master' into feat/developer/9403-scancodes-epic-ldml
Browse files Browse the repository at this point in the history
  • Loading branch information
srl295 authored Sep 25, 2023
2 parents 71aee7a + efd92af commit 8774651
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
4 changes: 4 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Keyman Version History

## 17.0.180 alpha 2023-09-25

* fix(linux): Fix detection of unit tests (#9606)

## 17.0.179 alpha 2023-09-22

* chore(resources): ldml: update to keyboard3 (#9588)
Expand Down
2 changes: 1 addition & 1 deletion VERSION.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
17.0.180
17.0.181
11 changes: 10 additions & 1 deletion linux/keyman-config/keyman_config/sentry_handling.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import os
import platform
import sys
import traceback
from keyman_config.version import (
__version__,
__versionwithtag__,
Expand Down Expand Up @@ -47,7 +48,7 @@ def initialize_sentry(self):
return (True, '')

def is_sentry_enabled(self):
if 'unittest' in sys.modules.keys():
if self._is_unit_test():
return (False, 'Running unit tests, not reporting to Sentry')
elif self._get_environ_nosentry():
return (False, 'Not reporting to Sentry because KEYMAN_NOSENTRY environment variable set')
Expand Down Expand Up @@ -75,6 +76,14 @@ def _get_environ_nosentry(self):
keyman_nosentry = os.environ.get('KEYMAN_NOSENTRY')
return keyman_nosentry and (int(keyman_nosentry) == 1)

def _is_unit_test(self): # sourcery skip: use-any, use-next
# The suggested refactorings (using any() or next()) don't work
# when testing on Ubuntu 20.04
for line in traceback.format_stack():
if '/unittest/' in line:
return True
return False

def _handle_enabled(self, enabled):
if enabled:
self.initialize_sentry()
Expand Down

0 comments on commit 8774651

Please sign in to comment.