| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 51a95be commit 8726067
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,6 +5,7 @@ | |||
| 5 | 5 | ||
| 6 | 6 | import contextlib | |
| 7 | 7 | import functools | |
| 8 | + import getpass | ||
| 8 | 9 | import os | |
| 9 | 10 | import re | |
| 10 | 11 | import stat | |
@@ -378,10 +379,11 @@ def skip_if_buildbot(reason=None): | |||
| 378 | 379 | """Decorator raising SkipTest if running on a buildbot.""" | |
| 379 | 380 | if not reason: | |
| 380 | 381 | reason = 'not suitable for buildbots' | |
| 381 | - if sys.platform == 'win32': | ||
| 382 | - isbuildbot = os.environ.get('USERNAME') == 'Buildbot' | ||
| 383 | - else: | ||
| 384 | - isbuildbot = os.environ.get('USER') == 'buildbot' | ||
| 382 | + try: | ||
| 383 | + isbuildbot = getpass.getuser().lower() == 'buildbot' | ||
| 384 | + except (KeyError, EnvironmentError) as err: | ||
| 385 | + warnings.warn(f'getpass.getuser() failed {err}.', RuntimeWarning) | ||
| 386 | + isbuildbot = False | ||
| 385 | 387 | return unittest.skipIf(isbuildbot, reason) | |
| 386 | 388 | ||
| 387 | 389 | def check_sanitizer(*, address=False, memory=False, ub=False): | |
| Back | FazBrowse Home | New Git URL |
0 commit comments