"validate" cannot detect error in R code
See original GitHub issueI’m trying to use nbgrader for R language, but the “Validate” button and autograder doesn’t detect errors in answer cells. I tried the following commands to throw error, but “validate” button always returns the message “Success! Your notebook passes all the tests” and I always got full score.
raise NotImplementedError()
fail()
e <- simpleError("test error")
stop(e)
throw('NotImplementedError')
When I run the cells above, they return Error, so I think nbgrader seems not to detect the thrown error. I’m currently using nbgrader for python on the same system without problems. Is there some solution?
Operating system
Ubuntu 16.04.6 LTS
nbgrader --version
nbgrader version 0.6.1
jupyterhub --version
(if used with JupyterHub)
0.9.6
jupyter notebook --version
6.0.2
Expected behavior
Detect errors in notebook
Actual behavior
“Validate” button doesn’t detect erros.
Issue Analytics
- State:
- Created 3 years ago
- Comments:12 (7 by maintainers)
Top Results From Across the Web
errorlocate: Locate Errors with Validation Rules
The errorlocate helps to identify obvious errors in raw datasets. While validate can identify if a record is valid or not, it does...
Read more >Validating Data Using Asserts in R - Pluralsight
In this guide, you will learn to validate data using asserts in R. Specifically, we'll be using the Assertr package, which provides variety ......
Read more >Can't find the syntax error in R function code - Stack Overflow
I have a syntax error in my R function code, and I can't find it. Before I made it into a function it...
Read more >Write error messages for your UI with validate - R Shiny
Validation errors are designed to interact with the Shiny framework in a pleasing way. Shiny will: recognize a validation error; display a ...
Read more >9 Debugging and error handling | Building Web Apps with R ...
A great coder isn't someone who writes bug-free code on their first try (this is an unachievable goal), but rather someone who knows...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yeah this latter point does indeed seem like a bug, I would also expect the validator to say the test has failed even if it is worth zero points.
Thank you for your comment.
I found three reasons why “Validate button” doesn’t work as my expectations.
“Validate button” doesn’t detect error by
stop(“NotImplementedError”) or raise(…)
in answer cells, because answer cells are not targets of failure check in _get_failed_cells() in validator.py.
Now, I understand it’s a specification of nbgrader.
"output_type": “stream”
, so this is a similar case in #1381. I was pointed out about this problem by Ian before, but I checked the results of the above case (1), and didn’t notice this problem. Sorry Ian.A different point from #1381 is that test_that() function doen’t produce
output.name=stderr
butoutput.name=stdout
, so there no clue to find the error in the autograde cell.To resolve this problem, I redefined the test_that() as below.
It seems working now!