ropensci-archive / tidytags

⛔ ARCHIVED ⛔ Importing and Analyzing Twitter Data Collected with Twitter Archiving Google Sheets
https://docs.ropensci.org/tidytags/
Other
13 stars 6 forks source link

Reverse dependency checks of rtweet found a problem #90

Closed llrs closed 1 year ago

llrs commented 1 year ago

rtweet will soon have a need release with some improvements and bug fixes. While testing for possible problems I found out that current changes break the tidytags package, tested locally in my computer R 4.2.2 and Ubuntu 22.04.

The problem is triggered detected by test-11-add_users_data.R:

Error ```r > library(testthat) > library(tidytags) > > test_check("tidytags") [ FAIL 1 | WARN 3 | SKIP 0 | PASS 266 ] ══ Failed tests ════════════════════════════════════════════════════════════════ ── Error ('test-11-add_users_data.R:14'): (code run outside of `test_that()`) ── Error: ================================================================================ An HTTP request has been made that vcr does not know how to handle: GET https://api.twitter.com/1.1/users/lookup.json?screen_name=ifyouaskbetty%2Ccaranorth11%2Conmyway2here%2CMattheaMarquart%2Chodgesc%2CAECT%2CLiuJh_Christie%2Charmonygritz%2Cmarshallgjones%2Cshonn2nd%2Cgsa_aect%2Caectddl%2CMohamedmetwa%2Ctutaleni%2ClbukunAA%2Cmarkoteras%2CGabrielKonayuma%2Cconstatively%2Cwavinya66%2Ctadousay%2Caectclt%2CDrFrankGomez%2Cvt_idt%2CELTAugusta%2Cclement_abai%2CCherylHW%2CSebLopJr%2CUMassLinguistic%2Caectrtd%2CDavidGilbertVO%2CETHEjournal%2Cnicolapallitt%2Ccorreia65%2CemergeAfrica%2Clsbu_crit%2CTech_DrL%2Ckoubenec%2Cpattishank%2Ceromerohall%2CRoutledgeEd vcr is currently using the following cassette: - /home/lluis/Documents/Projects/rtweet/revdep/checks/tidytags/new/tidytags.Rcheck/tests/fixtures/users_info.yml - record_mode: once - match_requests_on: method, uri Under the current configuration vcr can not find a suitable HTTP interaction to replay and is prevented from recording new requests. There are a few ways you can deal with this: * If you're surprised vcr is raising this error and want insight about how vcr attempted to handle the request, you can use 'logging' to see more details [1]. * You can use the :new_episodes record mode to allow vcr to record this new request to the existing cassette [2]. * If you want vcr to ignore this request (and others like it), you can set an `ignore_request` function [3]. * The current record mode ('once') does not allow new requests to be recorded to a previously recorded cassette. You can delete the cassette file and re-run your tests to allow the cassette to be recorded with this request [4]. * The cassette contains 1 HTTP interaction that has not been played back. If your request is non-deterministic, you may need to change your 'match_requests_on' cassette option to be more lenient or use a custom request matcher to allow it to match [5]. [1] https://books.ropensci.org/http-testing/debugging-your-tests-that-use-vcr.html#logging-1 [2] https://books.ropensci.org/http-testing/record-modes.html#new_episodes [3] https://books.ropensci.org/http-testing/vcr-configuration#config-ignore-requests [4] https://books.ropensci.org/http-testing/record-modes.html#once [5] https://books.ropensci.org/http-testing/request-matching ================================================================================ Backtrace: ▆ 1. ├─vcr::use_cassette(...) at test-11-add_users_data.R:14:0 2. │ └─cassette$call_block(...) 3. └─tidytags::add_users_data(el) at test-11-add_users_data.R:15:2 4. └─rtweet::lookup_users(all_users) 5. └─rtweet:::TWIT_paginate_chunked(...) 6. ├─rtweet:::catch_rate_limit(...) 7. │ └─base::tryCatch(code, rtweet_rate_limit = function(e) e) 8. │ └─base (local) tryCatchList(expr, classes, parentenv, handlers) 9. │ └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 10. │ └─base (local) doTryCatch(return(expr), name, parentenv, handler) 11. └─rtweet:::TWIT_get(...) 12. └─rtweet:::TWIT_method(...) 13. └─httr::GET(url, query = params, token, ...) 14. └─httr:::request_perform(req, hu$handle$handle) 15. └─httr:::perform_callback("request", req = req) 16. └─webmockr (local) callback(...) 17. └─webmockr::HttrAdapter$new()$handle_request(req) 18. └─private$request_handler(req)$handle() 19. └─eval(parse(text = req_type_fun))(self$request) 20. └─err$run() 21. └─self$construct_message() ```

The data in sample_tags has changed and running the tests again does not create the same uri because the users have changed, thus failing the check:

Recorded uri: https://api.twitter.com/1.1/users/lookup.json?screen_name=nicolapallitt%2CHarriet96152202%2CELTAugusta%2Cgsa_aect%2CAECTTechTrends%2Caectddl%2CCherylHW%2Ctutaleni%2Ctreymartindale%2CSebLopJr%2Ccorreia65%2Cmarshallgjones%2CLiuJh_Christie%2CDrFrankGomez%2CGabrielKonayuma%2CDavidGilbertVO%2Cthe80kcrew%2Cifyouaskbetty%2Cpattishank%2Cclement_abai%2Cshonn2nd%2CAECT%2Cwavinya66%2Caectclt%2Cmarkoteras%2Ckoubenec%2CMohamedmetwa%2ClbukunAA%2CMattheaMarquart%2Charmonygritz%2Cconstatively%2CUMassLinguistic%2Clsbu_crit%2Cmichaelmgrant%2Cvt_idt%2Conmyway2here%2Chodgesc%2CETHEjournal%2CemergeAfrica%2Cvrodes%2C_COER_%2Csukainaw%2Cleohavemann%2CMarkJ_ohnson%2CMargyMacLibrary%2CLucyappert%2CChri5rowell%2CRitaFennelly%2CSuzanKoseoglu%2CTech_DrL%2Ceromerohall%2CRoutledgeEd
Current uri:  https://api.twitter.com/1.1/users/lookup.json?screen_name=ifyouaskbetty%2Ccaranorth11%2Conmyway2here%2CMattheaMarquart%2Chodgesc%2CAECT%2CLiuJh_Christie%2Charmonygritz%2Cmarshallgjones%2Cshonn2nd%2Cgsa_aect%2Caectddl%2CMohamedmetwa%2Ctutaleni%2ClbukunAA%2Cmarkoteras%2CGabrielKonayuma%2Cconstatively%2Cwavinya66%2Ctadousay%2Caectclt%2CDrFrankGomez%2Cvt_idt%2CELTAugusta%2Cclement_abai%2CCherylHW%2CSebLopJr%2CUMassLinguistic%2Caectrtd%2CDavidGilbertVO%2CETHEjournal%2Cnicolapallitt%2Ccorreia65%2CemergeAfrica%2Clsbu_crit%2CTech_DrL%2Ckoubenec%2Cpattishank%2Ceromerohall%2CRoutledgeEd

I will proceed with my submission plan, either this weekend or during the next week I will submit the new rtweet to CRAN. Sorry for the short notice, I didn't expect to find a problem with the dependencies of rtweet as this release fixes some bugs and provides new functionality.

bretsw commented 1 year ago

@llrs thanks for the heads up. I'll take a look!

llrs commented 1 year ago

Finally, I submitted the new rtweet version and the error was detected by CRAN, see this report of reverse dependency checks. It will stay for a week from now more or less, copying here the results:

 > test_check("tidytags")
    [ FAIL 1 | WARN 3 | SKIP 0 | PASS 266 ]

    ══ Failed tests ════════════════════════════════════════════════════════════════
    ── Error ('test-11-add_users_data.R:14'): (code run outside of `test_that()`) ──
    Error: 

    ================================================================================
    An HTTP request has been made that vcr does not know how to handle:
    GET https://api.twitter.com/1.1/users/lookup.json?screen_name=ifyouaskbetty%2Ccaranorth11%2Conmyway2here%2CMattheaMarquart%2Chodgesc%2CAECT%2CLiuJh_Christie%2Charmonygritz%2Cmarshallgjones%2Cshonn2nd%2Cgsa_aect%2Caectddl%2CMohamedmetwa%2Ctutaleni%2ClbukunAA%2Cmarkoteras%2CGabrielKonayuma%2Cconstatively%2Cwavinya66%2Ctadousay%2Caectclt%2CDrFrankGomez%2Cvt_idt%2CELTAugusta%2Cclement_abai%2CCherylHW%2CSebLopJr%2CUMassLinguistic%2Caectrtd%2CDavidGilbertVO%2CETHEjournal%2Cnicolapallitt%2Ccorreia65%2CemergeAfrica%2Clsbu_crit%2CTech_DrL%2Ckoubenec%2Cpattishank%2Ceromerohall%2CRoutledgeEd
    vcr is currently using the following cassette:
      - /home/hornik/tmp/CRAN/tidytags.Rcheck/tests/fixtures/users_info.yml
        - record_mode: once
        - match_requests_on: method, uri
    Set `VCR_VERBOSE_ERRORS=TRUE` for more verbose errors
    If you're not sure what to do, open an issue https://github.com/ropensci/vcr/issues
    & see https://books.ropensci.org/http-testing
llrs commented 1 year ago

rtweet has received the green light from the CRAN team, this might result in failing tests in tidytags and an email asking you to update the package soon. I hope you can update it soon and keep tidytags in CRAN.

bretsw commented 1 year ago

Thanks for the heads up, @llrs. I was able to address the errors by recording a new vcr cassette. I've pushed tidytags v1.1.1 to CRAN, so all should be well.