> On Aug 7, 2018, at 10:56 AM, Alexis King wrote:
>
> I guess I’ll take the bait and give the obvious-but-unhelpful answer,
> “Don’t use global variables.” :)
>
> I’m joking, but only just barely. It seems difficult to give concrete
> advice without knowing more details about your program
If this is a problem only in your test code, you could write a function to
reset/re-initialize the global state, and call that function at the
beginning of each test.
If you want to have a "global state" for each of the file that requires
your module, global variables might not be the right
> On Aug 7, 2018, at 10:56 AM, Alexis King wrote:
>
> I guess I’ll take the bait and give the obvious-but-unhelpful answer,
> “Don’t use global variables.” :)
>
> I’m joking, but only just barely. It seems difficult to give concrete
> advice without knowing more details about your program
I guess I’ll take the bait and give the obvious-but-unhelpful answer,
“Don’t use global variables.” :)
I’m joking, but only just barely. It seems difficult to give concrete
advice without knowing more details about your program and why you felt
it was necessary to use global mutable state in the
I’ve got a library that takes maintains global variables. I’d like to be able
to test different test files that require this library, but of course if I
require those files into a single test file for testing various combinations of
data it corrupts the global variables, which are only valid
5 matches
Mail list logo