emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [babel] BUG in :session


From: Eric Schulte
Subject: Re: [O] [babel] BUG in :session
Date: Wed, 21 Sep 2011 20:23:24 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Hi Martyn,

I've just pushed up what will hopefully be a more general solution.
Basically, language-specific test files can now signal errors if they
have unmet dependencies.  These are then intercepted by `org-test-load'
and the file is not added to the test suite.  Hopefully this will allow
language-specific tests to be written without breaking the config-less
test suite.

See the top of test-ob-R.el for an example usage.

Cheers -- Eric

Martyn Jago <address@hidden> writes:

> Hi Sebastien and Eric
>
> "Sebastien Vauban"
> <address@hidden> writes:
>
>> Hi Eric and Martyn,
>>
>> Eric Schulte wrote:
>>> Martyn Jago <address@hidden> writes:
>>>> Unfortunately this test introduces an external dependency for R (which I
>>>> haven't currently got on my system so fails here). Not sure if that is
>>>> avoidable - I have no problem installing it if not. 
>>>
>>> Yes, I think we're going to have to start putting some conditional
>>> checks into org-test-run-all-tests so that only those code block tests
>>> for which the required languages exist on the user's system are run.  I
>>> don't know the best way to handle this.
>>
>> Testing both if:
>>
>> - the language is activated (`org-babel-load-languages')
>> - the interpreter is found on the system (`exec-path')
>>
>> ?
>>
>> Just an idea...
>>
>
> I was thinking along the same lines, as a stop-gap at least...
>  - test for feature ESS
>  - test for R
>  - If either are missing, 'bypass' the test but add a note to the test
>   backtrace to that effect.
>  - If dependencies are satisfied, run the test proper.
>
> My main problem is that my 'config-less' tests are now failing across
> Emacs 22, 23 and 24 (obviously), and are thus no longer particularly
> useful!
>
> I have included a patch that fixes things for me, but are you still
> confident Eric that in the short term your test will still catch the
> intended failure mode. I have little doubt that ultimately there will be
> a more satisfactory solution.
>
> Best, Martyn
>
> From de40e439d1a4d110a47d5a0701741493a285143c Mon Sep 17 00:00:00 2001
> From: Martyn Jago <address@hidden>
> Date: Wed, 21 Sep 2011 22:01:16 +0100
> Subject: [PATCH] Bypass test where dependencies missing
>  * testing/lisp/test-ob-R.el:
>  If R or ESS are missing don't run test
>  but add NOTE to this effect in test
>  backtrace
>
> ---
>  testing/lisp/test-ob-R.el |   10 +++++++---
>  1 files changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/testing/lisp/test-ob-R.el b/testing/lisp/test-ob-R.el
> index 1fe63a5..457bf9c 100644
> --- a/testing/lisp/test-ob-R.el
> +++ b/testing/lisp/test-ob-R.el
> @@ -16,9 +16,13 @@
>  (require 'ob-R)
>  
>  (ert-deftest test-ob-R/simple-session ()
> -  (org-test-with-temp-text
> -      "#+begin_src R :session R\n  paste(\"Yep!\")\n#+end_src\n"
> -    (should (string= "Yep!" (org-babel-execute-src-block)))))
> +  (if (and (featurep 'ess)
> +        (eql 0 (shell-command org-babel-R-command)))
> +      (org-test-with-temp-text
> +       "#+begin_src R :session R\n  paste(\"Yep!\")\n#+end_src\n"
> +     (should (string= "Yep!" (org-babel-execute-src-block))))
> +    (message "NOTE: =test-ob-R/simple-session= NOT run!
> + R and ESS are required to run =test-ob-R/simple-session=")))
>  
>  (provide 'test-ob-R)

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]