-
Notifications
You must be signed in to change notification settings - Fork 32
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
fix ob-async does not work with :results file link
based types.
#52
Conversation
🎉 Thanks @stardiviner! I'll take a look at the PR this weekend and merge if it looks OK |
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.
Could you add a unit test for this, as well?
I write a test: modified test/ob-async-test.el
@@ -211,6 +211,26 @@ when content has been added below the source block"
(let ((foo-contents (progn (find-file "/tmp/foo") (buffer-substring-no-properties (point-min) (point-max)))))
(should (string= "Don't wait on me\n" foo-contents))))))))
+(ert-deftest test-async-execute-file-block ()
+ "Test that we can insert results when header-arg :file is present"
+ (let ((buffer-contents "Here's a sh source block:
+
+ #+BEGIN_SRC sh :async :results link :file \"/tmp/foo\"
+ echo \"Don't wait on me\" > /tmp/foo
+ #+END_SRC"))
+ (with-buffer-contents
+ buffer-contents
+ (org-babel-next-src-block)
+ (ctrl-c-ctrl-c-with-callbacks
+ :pre (should (placeholder-p (results-block-contents)))
+ :post (progn
+ (should (string= "[[file:/tmp/foo]]" (results-block-contents)))
+ (let ((foo-contents (progn
+ (find-file "/tmp/foo")
+ (buffer-substring-no-properties
+ (point-min) (point-max)))))
+ (should (string= "Don't wait on me\n" foo-contents))))))))
+
(ert-deftest test-async-execute-table-output ()
"Test that we can insert table output"
(let ((buffer-contents "Here's a source block: But run
This is weird. |
Here is part of backtrace: https://gist.github.com/d5da758eca42a55df084fea5824cd73b |
@stardiviner I think your PR should be passing tests now, but since you force-pushed Travis seems to be in a weird state and isn't running against your latest commit. Not sure what's going on there - maybe try opening a new Pull Request? |
Seems force push can't re-trigger Travis CI. Is that need to re-open a new PR? Ok, I will. |
Ok, I tried to create a new PR with same you and mine |
I checked out Travis CI log, two error reports are failed on
|
test/ob-async-test.el
Outdated
(ctrl-c-ctrl-c-with-callbacks | ||
:pre (should (placeholder-p (results-block-contents))) | ||
:post (progn | ||
(should (string= "[[file:/tmp/foo]]" (results-block-contents))) |
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.
This should just be (string= "/tmp/foo")
. The raw text is "[[file:/tmp/foo]]", but (results-block-contents)
calls (org-babel-read-results)
, which turns [[file:/tmp/foo]]
into /tmp/foo
That last error looks like a transient error fetching from elpa. I just re-ran the tests, and this time the error looks real:
I think you can fix it by changing "[[file:/tmp/foo]]" to "/tmp/foo". No need to rebase and force-push when you make the change - I can squash your commits upon merging. |
Ok, I force pushed update. Thanks fore reviewing, @astahlman . |
@stardiviner I didn't have permission to push to your branch, so I created a throwaway PR and confirmed that it fixes the test: https://github.com/astahlman/ob-async/pull/54/files#r258313059 Want to apply that change to your branch so we can merge this one? (It's a one-line change). |
Ok, I added it now, force pushed. Seems trigger Tracis CI again now. |
Wow, all passed, clean green now. THanks @astahlman |
🎉 🎉 🎉 |
No description provided.