Don't add username to FIFO name on Linux.
The runtime directory already has a qutebrowser subdir.
This commit is contained in:
parent
3573b57130
commit
4daa7e6979
@ -56,12 +56,11 @@ def _get_socketname(basedir, legacy=False):
|
|||||||
|
|
||||||
if sys.platform.startswith('linux'):
|
if sys.platform.startswith('linux'):
|
||||||
target_dir = standarddir.runtime()
|
target_dir = standarddir.runtime()
|
||||||
parts = ['qutebrowser-ipc']
|
|
||||||
else: # pragma: no cover
|
else: # pragma: no cover
|
||||||
# OS X or other Unix
|
# OS X or other Unix
|
||||||
parts = ['ipc']
|
|
||||||
target_dir = standarddir.temp()
|
target_dir = standarddir.temp()
|
||||||
|
|
||||||
|
parts = ['ipc']
|
||||||
if basedir_md5 is not None:
|
if basedir_md5 is not None:
|
||||||
parts.append(basedir_md5)
|
parts.append(basedir_md5)
|
||||||
return os.path.join(target_dir, '-'.join(parts))
|
return os.path.join(target_dir, '-'.join(parts))
|
||||||
|
@ -176,6 +176,11 @@ class TestSocketName:
|
|||||||
('/x', 'qutebrowser-{}-{}'.format(getpass.getuser(), MD5)),
|
('/x', 'qutebrowser-{}-{}'.format(getpass.getuser(), MD5)),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
POSIX_TESTS = [
|
||||||
|
(None, 'ipc'),
|
||||||
|
('/x', 'ipc-{}'.format(MD5)),
|
||||||
|
]
|
||||||
|
|
||||||
@pytest.mark.parametrize('basedir, expected', LEGACY_TESTS)
|
@pytest.mark.parametrize('basedir, expected', LEGACY_TESTS)
|
||||||
def test_legacy(self, basedir, expected):
|
def test_legacy(self, basedir, expected):
|
||||||
socketname = ipc._get_socketname(basedir, legacy=True)
|
socketname = ipc._get_socketname(basedir, legacy=True)
|
||||||
@ -188,21 +193,15 @@ class TestSocketName:
|
|||||||
assert socketname == expected
|
assert socketname == expected
|
||||||
|
|
||||||
@pytest.mark.osx
|
@pytest.mark.osx
|
||||||
@pytest.mark.parametrize('basedir, expected', [
|
@pytest.mark.parametrize('basedir, expected', POSIX_TESTS)
|
||||||
(None, 'ipc'),
|
|
||||||
('/x', 'ipc-{}'.format(MD5)),
|
|
||||||
])
|
|
||||||
def test_os_x(self, basedir, expected):
|
def test_os_x(self, basedir, expected):
|
||||||
socketname = ipc._get_socketname(basedir)
|
socketname = ipc._get_socketname(basedir)
|
||||||
parts = os.path.split(socketname)
|
parts = socketname.split(os.sep)
|
||||||
assert parts[-2] == 'qutebrowser_test'
|
assert parts[-2] == 'qutebrowser_test'
|
||||||
assert parts[-1] == expected
|
assert parts[-1] == expected
|
||||||
|
|
||||||
@pytest.mark.linux
|
@pytest.mark.linux
|
||||||
@pytest.mark.parametrize('basedir, expected', [
|
@pytest.mark.parametrize('basedir, expected', POSIX_TESTS)
|
||||||
(None, 'qutebrowser-ipc'),
|
|
||||||
('/x', 'qutebrowser-ipc-{}'.format(MD5)),
|
|
||||||
])
|
|
||||||
def test_linux(self, basedir, fake_runtime_dir, expected):
|
def test_linux(self, basedir, fake_runtime_dir, expected):
|
||||||
socketname = ipc._get_socketname(basedir)
|
socketname = ipc._get_socketname(basedir)
|
||||||
expected_path = str(fake_runtime_dir / 'qutebrowser_test' / expected)
|
expected_path = str(fake_runtime_dir / 'qutebrowser_test' / expected)
|
||||||
|
Loading…
Reference in New Issue
Block a user