Re: [racket-users] Testing environment variable changes

2015-10-21 Thread Jack Firth
On Tuesday, October 20, 2015 at 11:56:33 AM UTC-7, Tim Brown wrote: > I'm not sure if I'd want to be able to arbitrarily change > current-proxy-servers on the fly (something that has proven difficult, > highlighted by the hoops I have to jump through in the tests). On the other > hand it's

Re: [racket-users] Testing environment variable changes

2015-10-20 Thread Jay McCarthy
I'd want Matthew and Sam's input on this, but I personally don't see anything wrong with have to parameterize with a promise: (parameterize ([c-p-s (delay '())]) ) It seems a lot cleaner than having the effectful behavior and using the parameter like a global variable (which I like to

Re: [racket-users] Testing environment variable changes

2015-10-20 Thread Tim Brown
My concern, and hence the entangled code, was one of compatibility (I'll defer to you guys whether that is a necessity). I'm not sure if I'd want to be able to arbitrarily change current-proxy-servers on the fly (something that has proven difficult, highlighted by the hoops I have to jump

Re: [racket-users] Testing environment variable changes

2015-10-19 Thread Jay McCarthy
On Mon, Oct 19, 2015 at 6:16 AM, Tim Brown wrote: > Folks, > > I’m coming close to writing unit tests for my “URL proxies from the > environment” code. > > Following suggestions from Sam and Jay, I’m considering using a promise > to get and parse the environment

Re: [racket-users] Testing environment variable changes

2015-10-19 Thread Matthew Flatt
As an alternative to running a separate process and capturing I/O, you could create a fresh namespace and environment-variable table for each configuration, along the lines of (parameterize ([current-namespace (make-base-namespace)] [current-environment-variables

[racket-users] Testing environment variable changes

2015-10-19 Thread Tim Brown
Folks, I’m coming close to writing unit tests for my “URL proxies from the environment” code. Following suggestions from Sam and Jay, I’m considering using a promise to get and parse the environment variables... along the line of: (define add-no-proxies-from-environment-promise (delay

Re: [racket-users] Testing environment variable changes

2015-10-19 Thread Tim Brown
Jay, PR#1089 has changes to allow current-proxy-servers and current-no-proxy-servers to be loaded from the environment. I’m doing testing through a sandbox, because I’m not comfortable that it’s necessary to spawn a process and Matthew’s suggestion seems to make my promises be forced once :-( I