File tree Expand file tree Collapse file tree 4 files changed +36
-2
lines changed
plugin/openassetio_manager_bal Expand file tree Collapse file tree 4 files changed +36
-2
lines changed Original file line number Diff line number Diff line change 1
1
Release Notes
2
2
=============
3
3
4
+ v1.0.0-alpha.x
5
+ ---------------
6
+
7
+ ### New features
8
+
9
+ - Added support for ` OPENASSETIO_BAL_IDENTIFIER ` environment variable,
10
+ for overriding the identifier advertised by the BAL plugin/manager.
11
+ [ #116 ] ( https://github.com/OpenAssetIO/OpenAssetIO-Manager-BAL/pull/116 )
12
+
4
13
v1.0.0-alpha.16
5
14
---------------
6
15
Original file line number Diff line number Diff line change 53
53
"BasicAssetLibraryInterface" ,
54
54
]
55
55
56
+
57
+ DEFAULT_IDENTIFIER = "org.openassetio.examples.manager.bal"
58
+ ENV_VAR_IDENTIFIER_OVERRIDE = "OPENASSETIO_BAL_IDENTIFIER"
56
59
SETTINGS_KEY_LIBRARY_PATH = "library_path"
57
60
SETTINGS_KEY_SIMULATED_QUERY_LATENCY = "simulated_query_latency_ms"
58
61
SETTINGS_KEY_ENTITY_REFERENCE_URL_SCHEME = "entity_reference_url_scheme"
@@ -105,7 +108,7 @@ def __init__(self):
105
108
self .__library = {}
106
109
107
110
def identifier (self ):
108
- return "org.openassetio.examples.manager.bal"
111
+ return os . environ . get ( ENV_VAR_IDENTIFIER_OVERRIDE , DEFAULT_IDENTIFIER )
109
112
110
113
def displayName (self ):
111
114
# Deliberately includes unicode chars to test string handling
Original file line number Diff line number Diff line change 42
42
need to be on `$PYTHONPATH` directly, the plugin system takes care
43
43
of extending Python's runtime paths accordingly.
44
44
"""
45
+ import os
45
46
46
47
# pylint: disable=import-outside-toplevel, invalid-name
47
48
#
51
52
# PythonPluginSystemManagerPlugin's implementation.
52
53
from openassetio .pluginSystem import PythonPluginSystemManagerPlugin
53
54
55
+ from .BasicAssetLibraryInterface import ENV_VAR_IDENTIFIER_OVERRIDE , DEFAULT_IDENTIFIER
56
+
54
57
55
58
class BasicAssetLibraryPlugin (PythonPluginSystemManagerPlugin ):
56
59
"""
@@ -61,7 +64,7 @@ class BasicAssetLibraryPlugin(PythonPluginSystemManagerPlugin):
61
64
62
65
@staticmethod
63
66
def identifier ():
64
- return "org.openassetio.examples.manager.bal"
67
+ return os . getenv ( ENV_VAR_IDENTIFIER_OVERRIDE , DEFAULT_IDENTIFIER )
65
68
66
69
@classmethod
67
70
def interface (cls ):
Original file line number Diff line number Diff line change @@ -74,6 +74,25 @@ def test_exposes_plugin_attribute_with_correct_type(self):
74
74
75
75
assert issubclass (openassetio_manager_bal .plugin , PythonPluginSystemManagerPlugin )
76
76
77
+ def test_when_not_overridden_by_env_var_then_identifier_matches_default (self ):
78
+ import openassetio_manager_bal # pylint: disable=import-outside-toplevel
79
+
80
+ assert (
81
+ openassetio_manager_bal .plugin .identifier () == "org.openassetio.examples.manager.bal"
82
+ )
83
+ assert (
84
+ openassetio_manager_bal .plugin .interface ().identifier ()
85
+ == "org.openassetio.examples.manager.bal"
86
+ )
87
+
88
+ def test_when_overridden_by_env_var_then_identifier_matches_env_var (self , monkeypatch ):
89
+ import openassetio_manager_bal # pylint: disable=import-outside-toplevel
90
+
91
+ monkeypatch .setenv ("OPENASSETIO_BAL_IDENTIFIER" , "foo" )
92
+
93
+ assert openassetio_manager_bal .plugin .identifier () == "foo"
94
+ assert openassetio_manager_bal .plugin .interface ().identifier () == "foo"
95
+
77
96
78
97
@pytest .fixture
79
98
def bal_business_logic_suite (bal_base_dir ):
You can’t perform that action at this time.
0 commit comments