Skip to content

Commit 8ca4f1a

Browse files
committed
Create a fresh Context in .cli.main()
Avoid leakage in tests when Context.get_instance(-1) refers to an instance created in a different test.
1 parent 45c5ade commit 8ca4f1a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

message_ix_models/cli.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def main(click_ctx, **kwargs):
7474
# NB this can't be Context.only(). When click.testing.CliRunner is used, there may
7575
# already be ≥2 Context instances created elsewhere in the test session before
7676
# this function is called to run CLI commands within the test session.
77-
click_ctx.obj = Context.get_instance(-1)
77+
click_ctx.obj = Context()
7878

7979
# Handle command-line parameters
8080
click_ctx.obj.core.handle_cli_args(**kwargs)

0 commit comments

Comments
 (0)