Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failures when running the tests interactively #47

Closed
maelle opened this issue Oct 21, 2020 · 1 comment · Fixed by #51
Closed

Failures when running the tests interactively #47

maelle opened this issue Oct 21, 2020 · 1 comment · Fixed by #51

Comments

@maelle
Copy link
Contributor

maelle commented Oct 21, 2020

For info as it doesn't seem to impede development :-)

I see the messages are in French, will try to fix

devtools::test( "path to httptest")
#> Loading httptest
#> Le chargement a nécessité le package : testthat
#> Testing httptest
#> ✔ |  OK F W S | Context
#> ⠏ |   0       | capture-requests                                                ⠋ |   1       | capture-requests                                                ⠼ |   5       | capture-requests                                                ⠋ |  11       | capture-requests                                                ⠸ |  14       | capture-requests                                                ⠼ |  15       | capture-requests                                                ⠏ |  20       | capture-requests                                                ⠼ |  24     1 | capture-requests                                                ⠧ |  27     1 | capture-requests                                                ⠏ |  29     1 | capture-requests                                                ✔ |  30     1 | capture-requests [3.9 s]
#> ────────────────────────────────────────────────────────────────────────────────
#> Skip (test-capture-requests.R:149:9): Recorded JSON is prettified
#> Reason: TODO: prettify when simplify=FALSE
#> ────────────────────────────────────────────────────────────────────────────────
#> ⠏ |   0       | content-type                                                    ✔ |   4       | content-type
#> ⠏ |   0       | expect-header                                                   ⠼ |   5       | expect-header                                                   ⠙ |  11     1 | expect-header                                                   ⠴ |  15     1 | expect-header                                                   ⠦ |  16     1 | expect-header                                                   ⠧ |  17     1 | expect-header                                                   ✔ |  17     1 | expect-header [0.8 s]
#> ────────────────────────────────────────────────────────────────────────────────
#> Skip (test-expect-header.R:40:13): expect_header with mock API
#> Reason: third_edition  is TRUE
#> ────────────────────────────────────────────────────────────────────────────────
#> ⠏ |   0       | fake-http                                                       ⠧ |   8       | fake-http                                                       ⠹ |  23       | fake-http                                                       ⠧ |  38       | fake-http                                                       ✔ |  42       | fake-http [0.3 s]
#> ⠏ |   0       | find-redactor                                                   ⠧ |   8       | find-redactor                                                   ⠹ |  13       | find-redactor
#> Using redact.R from "testpkg"
#> ⠸ |  14       | find-redactor                                                   ⠴ |  16       | find-redactor                                                   ⠇ |  18 1     | find-redactor                                                   ✖ |  18 1     | find-redactor [1.5 s]
#> ────────────────────────────────────────────────────────────────────────────────
#> ERROR (test-find-redactor.R:99:13): Loading a package with pkgload (devtools)
#> Error: l'espace de noms 'pkgload' est importé par 'devtools' et ne peut, donc, pas être déchargé
#> Backtrace:
#>  1. base::unloadNamespace("pkgload") test-find-redactor.R:99:12
#> ────────────────────────────────────────────────────────────────────────────────
#> ⠏ |   0       | json-equal                                                      ✔ |   7       | json-equal
#> ⠏ |   0       | mock-api                                                        ⠼ |   5       | mock-api                                                        ⠴ |  16       | mock-api                                                        ⠧ |  28       | mock-api                                                        ⠋ |  31       | mock-api                                                        ✔ |  46       | mock-api [0.6 s]
#> ⠏ |   0       | mock-paths                                                      ⠇ |   9       | mock-paths                                                      ✔ |  13       | mock-paths [0.1 s]
#> ⠏ |   0       | offline                                                         ⠼ |   4     1 | offline                                                         ✔ |   5     1 | offline [0.1 s]
#> ────────────────────────────────────────────────────────────────────────────────
#> Skip (test-offline.R:11:9): skip_if_disconnected when disconnected
#> Reason: This should skip
#> ────────────────────────────────────────────────────────────────────────────────
#> ⠏ |   0       | public                                                          ✖ |   1 1     | public
#> ────────────────────────────────────────────────────────────────────────────────
#> FAILURE (test-public.R:7:9): If a function is not exported, the public test context errors
#> `.internalFunction()` did not throw the expected error.
#> ────────────────────────────────────────────────────────────────────────────────
#> ⠏ |   0       | redact                                                          ⠋ |   1       | redact                                                          ⠸ |   4       | redact                                                          ⠦ |   7       | redact                                                          ⠹ |  13       | redact                                                          ⠋ |  21       | redact                                                          ⠸ |  24       | redact                                                          ⠦ |  27       | redact                                                          ⠏ |  35 3 1 1 | redact                                                          ✖ |  38 3 1 1 | redact [1.2 s]
#> ────────────────────────────────────────────────────────────────────────────────
#> FAILURE (test-redact.R:173:9): But the mock file gets written to the modified path with altered content
#> `object` did not throw the expected error.
#> 
#> Warning (test-redact.R:173:9): But the mock file gets written to the modified path with altered content
#> 4 components of `...` were not used.
#> 
#> We detected these problematic arguments:
#> * `fixed`
#> * `ignore.case`
#> * `perl`
#> * `useBytes`
#> 
#> Did you misspecify an argument?
#> Backtrace:
#>  1. httptest::expect_GET(GET("http://example.com/get"), "http://example.com/get") test-redact.R:173:8
#>  2. httptest::expect_mock_request(object, "GET ", url, " ", ...) /home/maelle/Documents/ropensci/httptest/R/expect-request.R:46:4
#>  3. request_happened()(...) /home/maelle/Documents/ropensci/httptest/R/expect-request.R:89:4
#>  4. testthat:::expect_condition_matching(...)
#>  6. ellipsis:::action_dots(...)
#> 
#> FAILURE (test-redact.R:175:9): But the mock file gets written to the modified path with altered content
#> `alt <- GET("http://example.com/fakeurl")` threw an unexpected error.
#> Message: GET http://example.com/fakeurl (example.com/fakeurl.json)
#> Class:   simpleError/error/condition
#> Backtrace:
#>   1. testthat::expect_error(...) test-redact.R:175:8
#>   7. httr::GET("http://example.com/fakeurl")
#>   8. httr:::request_perform(req, hu$handle$handle)
#>   9. httr:::request_fetch(req$output, req$url, handle)
#>  11. httptest::stop_request(req) /home/maelle/Documents/ropensci/httptest/R/mock-api.R:62:4
#> 
#> ERROR (test-redact.R:176:9): But the mock file gets written to the modified path with altered content
#> Error: objet 'alt' introuvable
#> Backtrace:
#>  1. testthat::expect_identical(content(alt), list(changed = TRUE)) test-redact.R:176:8
#>  4. httr::content(alt)
#>  6. httr:::is.response(x)
#> 
#> Skip (test-redact.R:203:9): gsub_response handles URL encoding
#> Reason: TODO: handle URL escaping
#> ────────────────────────────────────────────────────────────────────────────────
#> ⠏ |   0       | trace                                                           ⠸ |   4       | trace                                                           ✔ |   8       | trace [0.2 s]
#> ⠏ |   0       | use-httptest                                                    ⠦ |  17       | use-httptest                                                    ✔ |  35       | use-httptest [0.2 s]
#> ⠏ |   0       | vignette                                                        ⠋ |   1       | vignette                                                        ⠹ |  13       | vignette                                                        ✔ |  16       | vignette [1.0 s]
#> ⠏ |   0       | without-internet                                                ⠋ |   1       | without-internet                                                ⠸ |   4       | without-internet                                                ⠋ |  11       | without-internet                                                ✔ |  15     1 | without-internet [0.6 s]
#> ────────────────────────────────────────────────────────────────────────────────
#> Skip (test-without-internet.R:50:13): max.print option
#> Reason: third_edition  is TRUE
#> ────────────────────────────────────────────────────────────────────────────────
#> 
#> ══ Results ═════════════════════════════════════════════════════════════════════
#> Duration: 10.5 s
#> 
#> ── Skipped tests  ──────────────────────────────────────────────────────────────
#> ● TODO: handle URL escaping (1)
#> ● TODO: prettify when simplify=FALSE (1)
#> ● This should skip (1)
#> ● third_edition  is TRUE (2)
#> 
#> [ FAIL 5 | WARN 1 | SKIP 5 | PASS 295 ]

Created on 2020-10-21 by the reprex package (v0.3.0.9001)

@maelle
Copy link
Contributor Author

maelle commented Oct 21, 2020

==> devtools::test()

Loading httptest
Loading required package: testthat
Testing httptest|  OK F W S | Context|  30     1 | capture-requests [4.1 s]                 
─────────────────────────────────────────────────────────
Skip (test-capture-requests.R:149:9): Recorded JSON is prettified
Reason: TODO: prettify when simplify=FALSE
─────────────────────────────────────────────────────────
✓ |   4       | content-type|  17     1 | expect-header [1.1 s]                    
─────────────────────────────────────────────────────────
Skip (test-expect-header.R:40:13): expect_header with mock API
Reason: third_edition  is TRUE
─────────────────────────────────────────────────────────
✓ |  42       | fake-http [0.3 s]                        
⠋ |  11       | find-redactor                            Using redact.R from "testpkg"
x |  18 1     | find-redactor [2.0 s]                    
─────────────────────────────────────────────────────────
Error (test-find-redactor.R:99:13): Loading a package with pkgload (devtools)
Error: namespace 'pkgload' is imported by 'devtools' so cannot be unloaded
Backtrace:
 1. base::unloadNamespace("pkgload") test-find-redactor.R:99:12
─────────────────────────────────────────────────────────
✓ |   7       | json-equal|  46       | mock-api [0.7 s]                         
✓ |  13       | mock-paths [0.2 s]                       
✓ |   5     1 | offline [0.2 s]                          
─────────────────────────────────────────────────────────
Skip (test-offline.R:11:9): skip_if_disconnected when disconnected
Reason: This should skip
─────────────────────────────────────────────────────────
x |   1 1     | public                                   
─────────────────────────────────────────────────────────
Failure (test-public.R:7:9): If a function is not exported, the public test context errors
`.internalFunction()` did not throw the expected error.
─────────────────────────────────────────────────────────
x |  38 3 1 1 | redact [1.7 s]                           
─────────────────────────────────────────────────────────
Failure (test-redact.R:173:9): But the mock file gets written to the modified path with altered content
`object` did not throw the expected error.

Warning (test-redact.R:173:9): But the mock file gets written to the modified path with altered content
4 components of `...` were not used.

We detected these problematic arguments:
* `fixed`
* `ignore.case`
* `perl`
* `useBytes`

Did you misspecify an argument?
Backtrace:
 1. httptest::expect_GET(GET("http://example.com/get"), "http://example.com/get") test-redact.R:173:8
 2. httptest::expect_mock_request(object, "GET ", url, " ", ...) /home/maelle/Documents/ropensci/httptest/R/expect-request.R:46:4
 3. request_happened()(...) /home/maelle/Documents/ropensci/httptest/R/expect-request.R:89:4
 4. testthat:::expect_condition_matching(...)
 6. ellipsis:::action_dots(...)

Failure (test-redact.R:175:9): But the mock file gets written to the modified path with altered content
`alt <- GET("http://example.com/fakeurl")` threw an unexpected error.
Message: GET http://example.com/fakeurl (example.com/fakeurl.json)
Class:   simpleError/error/condition
Backtrace:
  1. testthat::expect_error(...) test-redact.R:175:8
  7. httr::GET("http://example.com/fakeurl")
  8. httr:::request_perform(req, hu$handle$handle)
  9. httr:::request_fetch(req$output, req$url, handle)
 11. httptest::stop_request(req) /home/maelle/Documents/ropensci/httptest/R/mock-api.R:62:4

Error (test-redact.R:176:9): But the mock file gets written to the modified path with altered content
Error: objet 'alt' introuvable
Backtrace:
 1. testthat::expect_identical(content(alt), list(changed = TRUE)) test-redact.R:176:8
 4. httr::content(alt)
 6. httr:::is.response(x)

Skip (test-redact.R:203:9): gsub_response handles URL encoding
Reason: TODO: handle URL escaping
─────────────────────────────────────────────────────────
✓ |   8       | trace [0.2 s]                            
✓ |  35       | use-httptest [0.2 s]                     
✓ |  16       | vignette [1.1 s]                         
✓ |  15     1 | without-internet [0.5 s]                 
─────────────────────────────────────────────────────────
Skip (test-without-internet.R:50:13): max.print option
Reason: third_edition  is TRUE
─────────────────────────────────────────────────────────

══ Results ══════════════════════════════════════════════
Duration: 12.5 s

── Skipped tests  ───────────────────────────────────────
● TODO: handle URL escaping (1)
● TODO: prettify when simplify=FALSE (1)
● This should skip (1)
● third_edition  is TRUE (2)

[ FAIL 5 | WARN 1 | SKIP 5 | PASS 295 ]

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 a pull request may close this issue.

1 participant