Closed jaraco closed 1 year ago
I ran the tests locally with Python 3.12a7 and they pass.
After upgrading to Python 3.12b2, I get the similar failures in test_multiprocessing, but tests still pass for test_winvault_always_viable
.
I say similar errors, because on my machine, the failures aren't about the backend failing to initialize but about "the system cannot find the file specified".
I created this script in an attempt to replicate the issue:
__requires__ = ['pywin32-ctypes']
import multiprocessing
from win32ctypes.pywin32 import win32cred
from win32ctypes.pywin32 import pywintypes
def run():
try:
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():
proc1 = multiprocessing.Process(target=run)
proc1.start()
proc1.join()
assert proc1.exitcode == 0
__name__ == '__main__' and run_child()
But when I run it, it succeeds without failure, so there's apparently something about keyring that's implicated in the failure.
Even running under pytest doesn't replicate the failure:
# run with py -3.12 -m pip-run -- -m pytest mod.py
__requires__ = ['pytest', 'pywin32-ctypes']
import multiprocessing
from win32ctypes.pywin32 import win32cred
from win32ctypes.pywin32 import pywintypes
def run():
try:
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()
I tried running under pytest too, but that also passes:
# run with py -3.12 -m pip-run -- -m pytest mod.py
__requires__ = ['pytest', 'pywin32-ctypes']
import multiprocessing
from win32ctypes.pywin32 import win32cred
from win32ctypes.pywin32 import pywintypes
def run():
try:
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()
That test does fail if I run it from the venv created by tox for keyring tests.
It seems that either coverage
or pytest-cov
is implicated, as I can replicate the failure with:
# run with py -3.12 -m pip-run -- -m pytest --cov mod.py mod.py
__requires__ = ['pytest', 'pywin32-ctypes', 'pytest-cov']
import multiprocessing
from win32ctypes.pywin32 import win32cred
from win32ctypes.pywin32 import pywintypes
def run():
try:
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()
That really sucks. It means that I need pytest, pywin32-ctypes, pytest-cov, and multiprocessing to replicate the failure. I'm worried there isn't going to be any hope of disentangling all of those concerns.
Tests on Windows are failing to find the backend (https://github.com/jaraco/keyring/actions/runs/5293285392/jobs/9581225875) on Python 3.12.
We should figure out what's changed.