[TIP] get fixtures for each parameter or global variables?
bjlockie at lockie.ca
Sat Oct 22 07:22:28 PDT 2016
On 2016-10-21 08:17 PM, Ben Finney wrote:
> James <bjlockie at lockie.ca> writes:
>> I'm trying to store the parameters in global variables so it doesn't
>> need to do pytest.config.getoption every time it wants a parameter.
> Please don't. Global state makes your program much more difficult to
> understand, because it means you can't limit the range of what may have
> caused an unexpected change.
> The feature of encapsulating complex structures inside namespaces is a
> Python feature. What are you hoping to gain by subverting that?
I'm trying to gain ease of use since all my tests will need the same
variables that contain the command line options.
More information about the testing-in-python