jaraco / keyring

MIT License
1.24k stars 152 forks source link

multiprocess tests failing on import-mode importlib #673

Closed jaraco closed 4 months ago

jaraco commented 4 months ago

After 6ff02e0, the tests started failing thus:

____________________________ test_multiprocess_get _____________________________

    def test_multiprocess_get():
        proc1 = multiprocessing.Process(target=subprocess_get)
        proc1.start()
        proc1.join()
>       assert proc1.exitcode == 0
E       AssertionError: assert 1 == 0
E        +  where 1 = <Process name='Process-1' pid=3403 parent=3006 stopped exitcode=1>.exitcode

tests/test_multiprocess.py:31: AssertionError
----------------------------- Captured stderr call -----------------------------
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/spawn.py", line 122, in spawn_main
    exitcode = _main(fd, parent_sentinel)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/spawn.py", line 132, in _main
    self = reduction.pickle.load(from_parent)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'tests'
____________________ test_multiprocess_get_after_native_get ____________________

    def test_multiprocess_get_after_native_get():
        keyring.get_password('test_app', 'test_user')
>       test_multiprocess_get()

tests/test_multiprocess.py:36: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

    def test_multiprocess_get():
        proc1 = multiprocessing.Process(target=subprocess_get)
        proc1.start()
        proc1.join()
>       assert proc1.exitcode == 0
E       AssertionError: assert 1 == 0
E        +  where 1 = <Process name='Process-2' pid=3404 parent=3006 stopped exitcode=1>.exitcode

tests/test_multiprocess.py:31: AssertionError
----------------------------- Captured stderr call -----------------------------
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/spawn.py", line 122, in spawn_main
    exitcode = _main(fd, parent_sentinel)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/spawn.py", line 132, in _main
    self = reduction.pickle.load(from_parent)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'tests'

On macOS only.

Running the tests against a62f allows the tests to pass again.

jaraco commented 4 months ago

The reason Linux isn't affected is because those multiprocess tests are disabled on Linux due to #410.