-
Notifications
You must be signed in to change notification settings - Fork 11
let code_string return nothing if definition returns nothing #92
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
Conversation
As suggested by @KristofferC in JuliaDocs/Documenter.jl#1779 (comment). This is related to problems using CodeTracking.jl with Documenter.jl (see JuliaDocs/Documenter.jl#1779) or Jupyter notebooks (see #51). Instead of throwing an exception, `code_string` now returns `nothing` if `definition` returns `nothing`. This makes it easier to handle such a problematic case by the user.
|
Bump |
|
Can you add a test, please? I'm not quite sure what your comment about the test means. Can't you reduce it to a standalone MWE? |
|
Right now, I only know minimal examples when running this in Jupyter notebooks or in Documenter.jl environments, not in "plain Julia" environments. Shall I add a Documenter setup just for testing this case? |
Co-authored-by: Tim Holy <tim.holy@gmail.com>
|
You can do this: ex = :(f_no_linenum(::Int) = 1)
deleteat!(ex.args[2].args, 1) # delete the file & line number info
eval(ex)and then run |
|
Thanks for the suggestion! I added such a test. |
test/runtests.jl
Outdated
| ex = :(f_no_linenum(::Int) = 1) | ||
| deleteat!(ex.args[2].args, 1) # delete the file & line number info | ||
| eval(ex) | ||
| @test_nowarn code_string(f_no_linenum, (Int,)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be @test code_string(f_no_linenum, (Int,)) == nothing or?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed in 65ff789
Co-authored-by: Kristoffer Carlsson <kristoffer.carlsson@juliacomputing.com>
Codecov Report
@@ Coverage Diff @@
## master #92 +/- ##
===========================================
- Coverage 88.06% 57.02% -31.05%
===========================================
Files 3 3
Lines 243 242 -1
===========================================
- Hits 214 138 -76
- Misses 29 104 +75
Continue to review full report at Codecov.
|
|
Thanks! |
|
Thank you |
As suggested by @KristofferC in JuliaDocs/Documenter.jl#1779 (comment). This is related to problems using CodeTracking.jl with Documenter.jl (see JuliaDocs/Documenter.jl#1779) or Jupyter notebooks (see #51). Instead of throwing an exception,
code_stringnow returnsnothingifdefinitionreturnsnothing. This makes it easier to handle such a problematic case by the user.Since the issue only appears in these on-standard environments, I do not really know a nice way to integrate an appropriate test in the current framework.