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

Silently ignoring syntax error in test file? #1360

Open
krlmlr opened this issue Mar 24, 2021 · 5 comments
Open

Silently ignoring syntax error in test file? #1360

krlmlr opened this issue Mar 24, 2021 · 5 comments
Labels
bug an unexpected problem or unintended behavior parallel ⇶

Comments

@krlmlr
Copy link
Member

krlmlr commented Mar 24, 2021

To replicate, run the "numbers" tests in r-lib/pillar@3611c62 via testthat::test_local(filter = "numbers"). Can't (easily) create a reprex here.

The syntax error is tibble::tibble::tibble, which is rejected by the parser in a clean session.

@gaborcsardi
Copy link
Member

gaborcsardi commented Mar 24, 2021

It is a bug in parallel testthat.

❯ Sys.setenv(TESTTHAT_PARALLEL = "FALSE")
❯ testthat::test_local(filter = "numbers")
✔ |  OK F W S | Context|   0       | numbers                                                         
Error in parse(con, n = -1, srcfile = srcfile, encoding = "UTF-8") :
  test-numbers.R:17:19: unexpected '::'
16:     # FIXME: Use fixed digits
17:     tibble::tibble::

@gaborcsardi gaborcsardi added bug an unexpected problem or unintended behavior parallel ⇶ labels Mar 24, 2021
@billdenney
Copy link
Contributor

I have a bug where a syntax error in a file causes testthat parallel to hang forever. The issue was a missing parenthesis, and there was no notification in the main process.

Is that the same as this?

@gaborcsardi
Copy link
Member

@billdenney Possibly.

@billdenney
Copy link
Contributor

@gaborcsardi , I just tried to make a reprex, and I got this behavior. So, I think that either my issue was the same or it's fixed.

@kamilzyla
Copy link

kamilzyla commented Feb 12, 2024

I have just been bitten by this. It seems that testthat::test_local() ignores all files with syntax errors when running in parallel. To reproduce, run the following in an empty directory:

usethis::create_package(".")
usethis::use_testthat(parallel = TRUE)
usethis::use_test("syntax")

# Whatever to create a syntax error
write("@", "tests/testthat/test-syntax.R", append = TRUE)

# Suceeds
testthat::test_local()

Tested with testthat 3.2.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior parallel ⇶
Projects
None yet
Development

No branches or pull requests

4 participants