Return the current user name, or None if getuser() does not work in the current environment (see #1010).
()
| 156 | |
| 157 | |
| 158 | def get_user() -> Optional[str]: |
| 159 | """Return the current user name, or None if getuser() does not work |
| 160 | in the current environment (see #1010).""" |
| 161 | import getpass |
| 162 | |
| 163 | try: |
| 164 | return getpass.getuser() |
| 165 | except (ImportError, KeyError): |
| 166 | return None |
| 167 | |
| 168 | |
| 169 | def pytest_configure(config: Config) -> None: |
no outgoing calls