Skip to content

Commit

Permalink
tests: write progress message to stderr, not stdout
Browse files Browse the repository at this point in the history
We can argue that this message isn't really the "output" of the tests,
but is just a temporary communication to the user that the program
hasn't hung unexpectedly.

`unittest` writes everything to stdout, and so with this commit, the
user who compiles the tests and runs
```
$ ./tests/all_tests > /tmp/configlet_test_results.txt
```
will no longer see the message in that file - they see it in their
terminal instead.
  • Loading branch information
ee7 authored and ErikSchierboom committed Mar 11, 2021
1 parent 2926acd commit 6401336
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions tests/test_binary.nim
Original file line number Diff line number Diff line change
Expand Up @@ -271,13 +271,12 @@ proc main =
const helpStart = &"Usage:\n {binaryName} [global-options] <command> [command-options]"

const cmd = "nimble --verbose build -d:release"
stdout.write(&"Running `{cmd}`... ")
stdout.flushFile()
stderr.write(&"Running `{cmd}`... ")
let (buildOutput, buildExitCode) = execCmdEx(cmd, workingDir = repoRootDir)
if buildExitCode == 0:
echo "success"
stderr.writeLine "success"
else:
echo "failure"
stderr.writeLine "failure"
raise newException(OSError, buildOutput)

suite "help as an argument":
Expand Down

0 comments on commit 6401336

Please sign in to comment.