standard library: bring the tests into the main CI#8525
Conversation
this allows the test runner to stop whenever there is a failing test and throw an `$env.LAST_EXIT_CODE` to `1`.
This commit introduces a bug in: - `test_logger::test_criticalansireset` - `test_logger::test_debugansireset` - `test_logger::test_erroransireset` - `test_std::test_assertansireset` - `test_std::test_path_addansireset`
This reverts commit 799c7eb.
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #8525 +/- ##
==========================================
+ Coverage 68.50% 68.51% +0.01%
==========================================
Files 624 631 +7
Lines 100672 101962 +1290
==========================================
+ Hits 68965 69864 +899
- Misses 31707 32098 +391 |
|
mm there is a failing test on i think this is quite unrelated to this very PR, but still, i will need some help here to fix this 😋 |
mm 🤔 i might be able to have access to a mac but only from tomorrow and at work 😅 if someone wants to try, the best would be to run |
sholderbach
left a comment
There was a problem hiding this comment.
Love it to have testing set up already!
.github/workflows/ci.yml
Outdated
| steps: | ||
| - uses: actions/checkout@v3 | ||
|
|
||
| - name: Setup Rust toolchain and cache | ||
| uses: actions-rust-lang/setup-rust-toolchain@v1.4.3 | ||
|
|
||
| - name: Install nushell | ||
| run: cargo install --path . ${{ matrix.flags }} |
There was a problem hiding this comment.
Could we reuse the virtualenv runner that already has this setup to save some time?
There was a problem hiding this comment.
oh that would be super nice 👍
i can have a look after lunch.
There was a problem hiding this comment.
ooh do you mean getting rid of the std-tests and simply put the nu .../tests.nu inside python-virtualenv?
There was a problem hiding this comment.
ooh do you mean getting rid of the
std-testsand simply put thenu .../tests.nuinsidepython-virtualenv?
Yeah we could combine them. It is a bit worse from a reporting perspective but we could make the std tests the first steps and folllow up with the virtualenv stuff.
There was a problem hiding this comment.
maybe we could reuse the artifact, i.e. the nu binary executable, generated by
- name: Install Nushell
run: cargo install --locked --path=. --profile ci --no-default-featuresin jobs.python-virtualenv ? 🤔
There was a problem hiding this comment.
shoud i move nu tests.nu inside python-virtualenv or the other way around? 😋
There was a problem hiding this comment.
I would recommend changing the name to something that reflects both. I think you can reuse the --profile ci build, which is debug without internal symbols which saves some time and cache.
There was a problem hiding this comment.
a name that reflects both, gotcha 👍
There was a problem hiding this comment.
mm that did not appear to trigger the CI 🤔
.github/workflows/ci.yml
Outdated
| - style: dataframe | ||
| flags: "--features=dataframe" |
There was a problem hiding this comment.
Mhh that might be a limitation on the virtualenv front as we don't run dataframe their anymore.
There was a problem hiding this comment.
to be honest with you, i did not really look at the whole CI and just copied the nu-tests job and modified the minimum, i.e. the name, the cargo install above and the nu .../tests.nu 😕
maybe that's a change to apply on the whole CI then ? 😮
There was a problem hiding this comment.
I think we should bite the bullet and add it for the ubuntu runner if necessary.
There was a problem hiding this comment.
i'm not sure i understand what should be done here 😮
|
|
@fdncred |
|
I can't really run them one at a time because after i maybe i need to do more setup |
|
After I use them like this I tried this but if I do it works - maybe i'm not using something right yup - i missed the use std.nu assert. |
|
ok, sorry for so many messages here. This is what's going on. /tmp is a symlink |
|
thanks @fdncred for your investigations ❤️ |
|
When assert fails, it may be helpful to print out the left hand side and the right hand side so this type of debugging isn't needed. |
agreed let me address these two issues |
It is fixed in #8515 |
|
Apparently there is a merge conflict? |
yes it's a conflict with the new as i know what's wrong, i wanted to resolve the conflicts at the end, after the CI has a good shape 😋 |
|
I tried it, I like the summary at the end. |
glad you like it 😌 |
in order for this to work, i found the following procedure - group by module name - tranpose to get out of the record - iterate over the modules and log in INFO mode - iterate over the module tests and log in DEBUG mode - still construct the same structure by adding `pass` to all test rows and then flattening the whole data
This comment was marked as outdated.
This comment was marked as outdated.
This was causing a "stack overflow" issue in the stdlib execution on windows.
37546cf to
00b820d
Compare
|
ooook, so after a looooot of debugging and investigation, i found the culprit... 🥁 🥁 🥁 it was the i removed it in 00b820d. i think i'll address the point made by @presidento in another PR 😌 |
|
|
||
| - name: Install Nushell | ||
| run: cargo install --locked --path=. --profile ci --no-default-features | ||
| run: cargo install --path . --locked --no-default-features |
There was a problem hiding this comment.
In an effort to not repeat this problem in the future, would you mind writing up some comments as to why we removed --profile ci? like, it causes stack overflows when running scripts with nu -c, or something like that.
|
I'm not quite sure I understand but I don't think we should be using |
These two options are not required to selected the list of tests to run and more options might be added in the future, which would make the documentation quickly deprecated.
|
thanks for the feedback and the improvement ideas, very sensible 👍 tell me if |
| # - "<indentation> x <module>::<test>" all in red if failed | ||
| # - "<indentation> <module>::<test>" all in green if passed | ||
| # - "<indentation> x <module> <test>" all in red if failed | ||
| # - "<indentation> <module> <test>" all in green if passed |
There was a problem hiding this comment.
You used double spaces instead of one. If it is intentional, I have no problem with that.
There was a problem hiding this comment.
to be honest. it's not on purpose 👀
There was a problem hiding this comment.
fixed with the proper <mod> <cmd> notation in 3f3b9ca 😋
|
Perfect. 👌 Thank you for your hard work. 👏 |
|
are we ready to land this? |
|
I think yes. |
👍 |
the first part of this PR comes from a request from @presidento in #8525. the second one is an improvement of the error support. # Description this PR - computes `module_search_pattern` to only `ls` the selected modules => the goal is to save search time in the future with more tests - gives better errors when - the `--path` is invalid - the `--module` does not exist - the search is too strict ### examples ```bash >_ nu crates/nu-utils/standard_library/tests.nu --path does-not-exist Error: × directory_not_found ╭─[<commandline>:1:1] 1 │ main --path does-not-exist · ───────┬────── · ╰── no such directory ╰──── ``` ```bash >_ nu crates/nu-utils/standard_library/tests.nu --module does-not-exist Error: × module_not_found ╭─[<commandline>:1:1] 1 │ main --module does-not-exist · ───────┬────── · ╰── no such module in /home/amtoine/.local/share/git/store/github.com/amtoine/nushell/crates/nu-utils/standard_library/ ╰──── ``` ```bash >_ nu crates/nu-utils/standard_library/tests.nu --command does_not_exist Error: × no test to run ``` instead of the previous ```bash >_ nu crates/nu-utils/standard_library/tests.nu --path does-not-exist Error: × No matches found for /home/amtoine/.local/share/git/store/github.com/amtoine/nushell/does-not-exist/test_*.nu ╭─[/home/amtoine/.local/share/git/store/github.com/amtoine/nushell/crates/nu-utils/standard_library/tests.nu:32:1] 32 │ let tests = ( 33 │ ls ($path | default $env.FILE_PWD | path join "test_*.nu") · ───────────────────────────┬─────────────────────────── · ╰── Pattern, file or folder not found 34 │ | each {|row| {file: $row.name name: ($row.name | path parse | get stem)}} ╰──── help: no matches found ``` ```bash >_ nu crates/nu-utils/standard_library/tests.nu --module does-not-exist Error: × expected table from pipeline ╭─[/home/amtoine/.local/share/git/store/github.com/amtoine/nushell/crates/nu-utils/standard_library/tests.nu:59:1] 59 │ $tests_to_run 60 │ | group-by module · ────┬─── · ╰── requires a table input 61 │ | transpose name tests ╰──── ``` ```bash >_ nu crates/nu-utils/standard_library/tests.nu --command does-not-exist Error: × expected table from pipeline ╭─[/home/amtoine/.local/share/git/store/github.com/amtoine/nushell/crates/nu-utils/standard_library/tests.nu:59:1] 59 │ $tests_to_run 60 │ | group-by module · ────┬─── · ╰── requires a table input 61 │ | transpose name tests ╰──── ``` # User-Facing Changes ``` $nothing ``` # Tests + Formatting ``` $nothing ``` # After Submitting ``` $nothing ```
…olkit (#8629) Related to #8525. # Description With #8525, the tests for the standard library have been enabled in the CI. The only places where these tests are missing are - the PR template - the toolkit This PR adds - `cargo run -- crates/nu-utils/standard_library/tests.nu` to the PR template - the same command as `toolkit test stdlib` - the `test stdlib` command to `toolkit check pr` # User-Facing Changes ``` $nothing ``` # Tests + Formatting the new output of `toolkit check pr`, with the same color code: > - 🟢 `toolkit fmt` > - 🟢 `toolkit clippy` > - 🟢 `toolkit test` > - 🟢 `toolkit test stdlib` # After Submitting ``` $nothing ```


Should close one of the tasks in #8450.
Description
std-testsjob to the CI whichnushellin the runnertests.numoduleec85b6fd..9c122115is where all the magic happens => see belowthe changes to the runner
the issue with the previous runner was the following: the clever trick of using
nu -c "use ...; test"did print the errors when occuring but they did not capture the true "failure", i.e. in all cases the$env.LAST_EXIT_CODEwas set to0, never stopping the CI when a test failed 🤔i first tried to
try/catchthe error in ec85b6f which kinda worked but only throw a single error, the first onei thought it was not the best and started thinking about a solution to have a complete report of all failing tests, at once, to avoid running the CI multiple times!
the easiest solution i found was the one i implemented in 9c12211
now the runner does the following
file,moduleandnamecolumns (first part of the pipe untilflattenandrename)passcolumnlog infotrueinpassif the test passes,falseotherwisehope you'll like it 😌
User-Facing Changes
Tests + Formatting
the standard tests now return a true error that will stop the CI
After Submitting