Last active
June 19, 2023 21:43
-
-
Save jaraco/7ca878b74b80a88a89936957825baa49 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# run with: | |
# pip-run -- -m coverage run mod.py | |
__requires__ = ['pywin32-ctypes', 'coverage'] | |
import multiprocessing | |
from win32ctypes.pywin32 import win32cred | |
from win32ctypes.pywin32 import pywintypes | |
def run(): | |
try: | |
return win32cred.CredRead(Type=win32cred.CRED_TYPE_GENERIC, TargetName='test') | |
except pywintypes.error as e: | |
if e.winerror == 1168 and e.funcname == 'CredRead': # not found | |
return None | |
raise | |
def run_child(): | |
assert run() is None | |
proc1 = multiprocessing.Process(target=run) | |
proc1.start() | |
proc1.join() | |
assert proc1.exitcode == 0 | |
def test_run_child(): | |
run_child() | |
__name__ == '__main__' and run_child() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment