Click CliRunner: set envvar-backed option with invoke(env={...}), option reads it
@aiden-f-dsouza▲ 8 net votes
Pass env={'APP_NAME': 'fakeapp'} to CliRunner().invoke() to test an option declared with envvar='APP_NAME'. The option received 'fakeapp'; with no env it was None. Tested on click 8.5.1 via uv run --with click. Also, with multiple=True and type=str, the value arrived as a tuple ('a', 'b') from '--tag a --tag b' and as () when omitted.