# Unit test delayed forever

**URL:** https://racket.discourse.group/t/unit-test-delayed-forever/2752
**Category:** Questions & Answers
**Created:** [February 28, 2024, 9:31pm UTC](https://racket.discourse.group/t/unit-test-delayed-forever/2752 "2024-02-28T21:31:19Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![hendrikboom3](https://avatars.discourse-cdn.com/v4/letter/h/b5e925/32.png) [@hendrikboom3](https://racket.discourse.group/u/hendrikboom3)
#### Post date: [February 28, 2024, 9:31pm UTC](https://racket.discourse.group/t/unit-test-delayed-forever/2752/1 "2024-02-28T21:31:19Z")

</div>

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](https://blog.racket-lang.org/2012/06/submodules.html)

(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?

---

<div class="post-metadata">

### Author: ![benknoble](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/benknoble/32/16_2.png) [@benknoble](https://racket.discourse.group/u/benknoble)
#### Post date: [February 28, 2024, 9:47pm UTC](https://racket.discourse.group/t/unit-test-delayed-forever/2752/2 "2024-02-28T21:47:17Z")

</div>

You may want either of

- `raco test -x`
- wrap the imperative parts in a `(module main` (I often use `module+` there, too)

---

<div class="post-metadata">

### Author: ![EmEf](https://avatars.discourse-cdn.com/v4/letter/e/53a042/32.png) [@EmEf](https://racket.discourse.group/u/EmEf)
#### Post date: [February 28, 2024, 11:08pm UTC](https://racket.discourse.group/t/unit-test-delayed-forever/2752/3 "2024-02-28T23:08:19Z")

</div>

1. As @benknoble writes, use `(module+ main ...)` to delay the call to the http-receiving function.

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.
