Unit test delayed forever

I have a program that, when run, builds some data structures, prints some diagnostic output, and then wait for an incoming http request on post 8080.

I decided to try to use the Racket test facility to do the diagnostics, defining a test submodule as described in Submodules

(1) I run it using the shell command
raco test

Of course it never gets around to performing any of the tests in the test submodule -- it sits and waits for an http request to come in on port 8080 instead. Is there a way around this?

I suppose it might make sense to suppress or delay the http request until testing succeeds, and abort if testing fails. But how?

(2) Is it possible to do the equivalent of

raco test

from DrRacket?

You may want either of

  • raco test -x
  • wrap the imperative parts in a (module main (I often use module+ there, too)
  1. As @benknoble writes, use (module+ main ...) to delay the call to the http-receiving function.

    Also, I teach my students to separate the two pieces of functionality with one function abstracting over the processing of the received HTML and the other really just connecting. Then this second function would be called in main.

  2. Since you use (module+ test ...) , DrRacket runs the submodules by default. Using cmd-L or ctrl-L (language preference dialog) you can configure which submodules are run by default. For @benknoble 's proposed organization, disable main so the DrRacket execution doesn't hang.