pietroppeter / nimib

nimib 🐳 - nim 👑 driven ⛵ publishing ✍
https://pietroppeter.github.io/nimib/
MIT License
181 stars 10 forks source link

Make tests less noisy + edit `getNimibVersion` a bit #243

Closed neroist closed 3 months ago

neroist commented 3 months ago

The commits explain the changes made -- the purpose for this PR is to make nimble test less noisy with less Nim compiler & Nimib printing to stdout. This PR also depends on #242 with switch("define", "nimibNoLog"), but that line can be easily removed if needed.

getNimibVersion() is changed as I wanted it to use the args parameter similar to the other invocations of execProcess().

pietroppeter commented 3 months ago

this make sense to me, thanks. the only pause of reflection I have is: the additional verbosity might be useful if a test is failing? maybe the answer is no, at the moment I am not entirely sure about it.

HugoGranstrom commented 3 months ago

Yes I'm also wondering what it looks like when you get a CI failure now. Maybe you could temporarily change a test to fail and we'll see what it looks like? 😄

neroist commented 3 months ago

this make sense to me, thanks. the only pause of reflection I have is: the additional verbosity might be useful if a test is failing? maybe the answer is no, at the moment I am not entirely sure about it.

I see, fine point! In that case switch("define", "nimibNoLog") may be removed. I don't see a point in keeping the warnings.

neroist commented 3 months ago

Odd, tests fail on my end...

here are the logs ``` [Suite] test sources [nimib] config file found: C:\Users\xxx\Downloads\nimib\nimib.toml [nimib] srcDir: C:\Users\xxx\Downloads\nimib\docsrc [nimib] filename: ..\tests\tsources.html [nimib] setting current directory to nb.homeDir: C:\Users\xxx\Downloads\nimib\docs [OK] 0 [OK] 1 [OK] 21 [Suite] newNbBlock [nimib] config file found: C:\Users\xxx\Downloads\nimib\nimib.toml [nimib] srcDir: C:\Users\xxx\Downloads\nimib\docsrc [nimib] filename: ..\tests\tblocks.html [nimib] setting current directory to nb.homeDir: C:\Users\xxx\Downloads\nimib\docs [OK] readCode [nimib] config file found: C:\Users\xxx\Downloads\nimib\nimib.toml [nimib] srcDir: C:\Users\xxx\Downloads\nimib\docsrc [nimib] filename: ..\tests\tnimib.html [nimib] setting current directory to nb.homeDir: C:\Users\xxx\Downloads\nimib\docs [Suite] nbText [OK] single line text string [OK] single line text string with strformat [OK] multi line text string [OK] multi line text string with strformat [Suite] nbTextWithCode [OK] single line text string [OK] single line text string with strformat [OK] multi line text string - variant 1 [OK] multi line text string - variant 2 [OK] multi line text string - variant 3 [OK] multi line text string with strformat [Suite] nbCode [OK] single line of code, no output C:\Users\xxx\Downloads\nimib\tests\tnimib.nim(134, 24): Check failed: nb.blk.output == "Hello world!!!\n" nb.blk.output was [OK] single line of code, with output [Suite] nbRawHtml [OK] pure text [OK] html tags [OK] Use inside template [Suite] nbClearOutput Hello world!!! C:\Users\xxx\Downloads\nimib\tests\tnimib.nim(135, 43): Check failed: nb.blk.context["output"].vString == "Hello world!!!" nb.blk.context["output"].vString was [OK] single line of code, with output [Suite] nbRawHtml [OK] pure text [OK] html tags [OK] Use inside template [Suite] nbClearOutput Hello world!!! C:\Users\xxx\Downloads\nimib\tests\tnimib.nim(162, 24): Check failed: nb.blk.output == "captured output\n" nb.blk.output was [FAILED] nbCode [Suite] nbCodeSkip [OK] single line of code with output [OK] destructive code [Suite] nbCapture captured output C:\Users\xxx\Downloads\nimib\tests\tnimib.nim(168, 24): Check failed: nb.blk.output == "" nb.blk.output was [FAILED] single line of code, with output C:\Users\xxx\Downloads\nimib\tests\tnimib.nim(269, 33): Check failed: nb.blocks[^2].output == "hi me\n" nb.blocks[^2].output was [FAILED] single line of code, without output [Suite] nbJs [OK] nbJsFromString [OK] nbJsFromCode [OK] nbJsFromCode, capture variable [OK] nbJsFromCodeGlobal [OK] nbJsFromCodeInBlock [OK] nbJsFromCodeOwnFile + exportc [OK] nbKaraxCode [OK] nbCodeDisplay hi me [FAILED] nbCodeAnd [Suite] test nimib/config [OK] getNimibVersion() Error: execution of an external program failed: 'C:\Users\xxx\nimcache\tnimib_d\tnimib_F0EFF1A7E8101F9F82F8F874FC486421B481E374.exe' stack trace: (most recent call last) C:\Users\xxx\AppData\Local\Temp\nimblecache-0\nimscriptapi_3723286288.nim(210, 16) C:\Users\xxx\Downloads\nimib\nimib.nimble(22, 7) testTask C:\Users\xxx\.choosenim\toolchains\nim-2.0.4\lib\system\nimscript.nim(265, 7) exec C:\Users\xxx\.choosenim\toolchains\nim-2.0.4\lib\system\nimscript.nim(265, 7) Error: unhandled exception: FAILED: nim r --hints:off tests/tnimib.nim [OSError] Tip: 11 messages have been suppressed, use --verbose to show them. nimscriptwrapper.nim(160) execScript Error: Exception raised during nimble script execution ```
neroist commented 3 months ago

rather remove the warnings than suppress

pietroppeter commented 3 months ago

Were you able to understand CI failures? Not sure I understand the last comment and why closing but you likely now best about it, just curious.

neroist commented 3 months ago

Were you able to understand CI failures? Not sure I understand the last comment and why closing but you likely now best about it, just curious.

Not too much. I think that the tests are better without -d:nimibQuiet (the logs would be very helpful for debug purposes).

I closed the PR because I'd rather remove the source of the warnings (e.g. unused imports & spacing issues) than just suppress them during compilation. Already done aswell.