File size: 808 Bytes
065fee7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import multiprocessing
import platform

import pytest

import keyring


@pytest.fixture(autouse=True)
def workaround_pytest_12178(monkeypatch):
    """
    Ensure the current directory is on sys.path so that `tests` is importable.

    Workaround for #673.
    """
    monkeypatch.syspath_prepend('.')


def subprocess_get():
    keyring.get_password('test_app', 'test_user')


pytestmark = [
    pytest.mark.xfail(
        platform.system() == 'Linux',
        reason="#410: keyring discovery fails intermittently",
    ),
]


def test_multiprocess_get():
    proc1 = multiprocessing.Process(target=subprocess_get)
    proc1.start()
    proc1.join()
    assert proc1.exitcode == 0


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