pytest-subprocess
pytest-subprocess copied to clipboard
check env of subprocess
trafficstars
I have some code along the lines of
subprocess.run(['thing'], env={'KEY': some_carefully_constructed_value()})
I can fake_process.register_subprocess(['thing'])
but there doesn't appear to be a way to check the env that was passed to the process
I also had
subprocess.run(f'KEY={some_carefully_constructed_value()} thing', shell=True)
but I couldn't find a way to grab that either
Thanks for reporting, you're right - there's no way to get that information as original arguments for Popen are not preserved anywhere. I don't know when I'll have a time to work on it, feel free to submit a PR if you want.