From 3d98b90928e93eb3fb8453d160653a8eb7f863aa Mon Sep 17 00:00:00 2001 From: Dmitri Gavrilov Date: Fri, 21 Jul 2023 12:38:30 -0400 Subject: [PATCH 1/2] ENH: add username to temporary profile directory (demo mode) --- bluesky_queueserver/manager/config.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bluesky_queueserver/manager/config.py b/bluesky_queueserver/manager/config.py index 6aaf909c..f6209289 100644 --- a/bluesky_queueserver/manager/config.py +++ b/bluesky_queueserver/manager/config.py @@ -5,6 +5,7 @@ """ import builtins import copy +import getpass import logging import os import sys @@ -683,7 +684,7 @@ def _get_startup_options(self): # If no location of startup code was specified, then load the default # simulated ipython_sim/profile_collection_sim if not any([startup_script, startup_module, startup_profile, ipython_dir]): - ipython_dir = os.path.join(tempfile.gettempdir(), "qserver", "ipython") + ipython_dir = os.path.join(tempfile.gettempdir(), f"qserver_{getpass.getuser()}", "ipython") startup_profile = default_startup_profile demo_mode = True From 8763cdb69a60e2c0be818b699d965a318789d563 Mon Sep 17 00:00:00 2001 From: Dmitri Gavrilov Date: Fri, 21 Jul 2023 15:47:06 -0400 Subject: [PATCH 2/2] TST: fixed unit test --- .../manager/tests/test_start_re_manager_cli.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bluesky_queueserver/manager/tests/test_start_re_manager_cli.py b/bluesky_queueserver/manager/tests/test_start_re_manager_cli.py index 14510d97..1db69e15 100644 --- a/bluesky_queueserver/manager/tests/test_start_re_manager_cli.py +++ b/bluesky_queueserver/manager/tests/test_start_re_manager_cli.py @@ -1,4 +1,5 @@ import copy +import getpass import os import pprint import re @@ -451,12 +452,13 @@ def test_cli_parameters_zmq_server_address_1(monkeypatch, re_manager_cmd, test_m def _get_expected_settings_default_1(tmpdir): use_ip_kernel = use_ipykernel_for_tests() + username = getpass.getuser() if use_ip_kernel: startup_dir = None - ipython_dir = "/tmp/qserver/ipython" + ipython_dir = f"/tmp/qserver_{username}/ipython" startup_profile = "collection_sim" - user_group_permissions_path = "/tmp/qserver/ipython/profile_collection_sim/startup" - existing_plans_and_devices_path = "/tmp/qserver/ipython/profile_collection_sim/startup" + user_group_permissions_path = f"/tmp/qserver_{username}/ipython/profile_collection_sim/startup" + existing_plans_and_devices_path = f"/tmp/qserver_{username}/ipython/profile_collection_sim/startup" else: startup_dir = "/bluesky_queueserver/profile_collection_sim/" ipython_dir = None