Skip to content

test: some suggestions for making failing test file more readable#10

Open
maelle wants to merge 3 commits into
masterfrom
tests
Open

test: some suggestions for making failing test file more readable#10
maelle wants to merge 3 commits into
masterfrom
tests

Conversation

@maelle

@maelle maelle commented Sep 30, 2024

Copy link
Copy Markdown
Member

👋 @quishqa!

I don't know yet why the Windows build is failing (I am on Ubuntu and can't run the tests locally yet see #9) however I think this test file can be made more informative when it fails by using more specific expectations. Some of them might be new to you, I think going over https://testthat.r-lib.org/reference/index.html once in a while is useful as new expectations appear over time (it's useful for me at least!).

Anyway as a summary:

  • no need to explicitly load the internal data.
  • I had trouble understanding the failure param_means["ws"] > 1 (actual) not equal to param_means["ws"] < 2 (expected)., using expect_lt() and expect_gt() instead will give a clearer failure.
  • I'd recommend moving the expectations around the class of pinheiros and its columns before the calculations.
  • These expectations around classes should use https://testthat.r-lib.org/reference/inheritance-expectations.html although for the columns I have added a comment, I think it'd make sense to create the vector of all class names then use expect_setequal() https://testthat.r-lib.org/reference/expect_setequal.html (it does not check the order of columns).

@maelle

maelle commented Sep 30, 2024

Copy link
Copy Markdown
Member Author

Now it's failing everywhere, clearly I did something wrong. Happy to run the tests locally once I have more instructions 🙈

@maelle

maelle commented Feb 7, 2025

Copy link
Copy Markdown
Member Author

@quishqa friendly reminder 😸

@quishqa

quishqa commented Feb 17, 2025

Copy link
Copy Markdown
Collaborator

Hi @maelle!
Sorry for the late answer, I'm back to maintaining qualR 🦾 .

  • By looking the commits, I think the errors are happening by removing the internal data which contains an example credential to test the functions (probably not a good practice).
  • I agree using expect_lt, expect_gt, expect_<class> functions, it produce a cleaner code.
    I believe I do need to read again testthat documentation 😞

@maelle

maelle commented Feb 17, 2025

Copy link
Copy Markdown
Member Author

Don't hesitate to ping me to ask any question!

@maelle

maelle commented Apr 29, 2025

Copy link
Copy Markdown
Member Author

@quishqa any help needed? 😸

@maelle

maelle commented Oct 7, 2025

Copy link
Copy Markdown
Member Author

@quishqa any update or help needed? 😸

@quishqa

quishqa commented Oct 13, 2025

Copy link
Copy Markdown
Collaborator

Hi @maelle, sorry for the delay. I think the error happens because in 5ca83eb the deleted file has the credentials to log in and download the data...

@maelle

maelle commented Oct 14, 2025

Copy link
Copy Markdown
Member Author

Do you need to cache/mock some stuff?

@maelle

maelle commented Nov 7, 2025

Copy link
Copy Markdown
Member Author

@quishqa any update / any help needed?

@maelle

maelle commented Mar 9, 2026

Copy link
Copy Markdown
Member Author

Current results on https://ropensci.r-universe.dev/builds

  Running the tests intests/testthat.Rfailed.
  Last 13 lines of output:
    Differences:
    `actual`:   FALSE
    `expected`: TRUE 
    
    ── Failure ('test-monitor_ar_retrieve_pol.R:15:3'): monitor_ar_retrieve_pol works! ──
    Expected `pol_means["pm10"] > 22` to equal `pol_means["pm10"] < 23`.
    Differences:
    `actual`:   FALSE
    `expected`: TRUE 
    
    
    [ FAIL 4 | WARN 0 | SKIP 0 | PASS 129 ]
    Error:
    ! Test failures.
    Execution halted

Any help needed?

@quishqa quishqa mentioned this pull request Mar 10, 2026
@quishqa

quishqa commented Mar 11, 2026

Copy link
Copy Markdown
Collaborator

Hi @maelle, Sorry for the delay. I solved the test error in my last PR, and also do a lot of the proposed suggestions. All test passed except for macOS...do you have any ideia?

@maelle

maelle commented Mar 12, 2026

Copy link
Copy Markdown
Member Author

I see the error involves the XML package. That package is no longer maintained (it's just kept alive by the CRAN team) so it might make sense to switch to xml2. I don't promise it'd solve the error but it's a good thing to do in any case 😸

@maelle

maelle commented Mar 12, 2026

Copy link
Copy Markdown
Member Author

Happy to help with xml2 if you have any question!

@maelle

maelle commented Jul 7, 2026

Copy link
Copy Markdown
Member Author

@quisha any update/help needed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants