This is more of a Pytest question rather than a Fl...
# flyte-support
n
This is more of a Pytest question rather than a Flyte one. I’m looking to see if there’s a preferred way of setting default values in
SecretsManager
within tests with the goal of not accidentally using secrets in
/etc/secrets
. We have a way of doing this now (I’ll add what we have in 🧵) but was hoping to see if there’s a standard way of doing this
We currently have this but had to reach into protected methods of current context (so wanted to see if there’s a simpler option):
Copy code
@pytest.fixture(autouse=True)
def setup_flyte_secrets_dir(mocker: MockerFixture):
     with TemporaryDirectory() as temp_dir:
         os.environ["FLYTE_SECRETS_DEFAULT_DIR"] = temp_dir

         # setting the ENV var wasn't enough since current_context may have been already initialized 
         secret_manager = SecretsManager()
         mocker.patch.object(current_context(), "_secrets_manager", secret_manager)
       
         # More setup stuff
t
@thankful-minister-83577 / @glamorous-carpet-83516 / @high-accountant-32689
158 Views