So let me preface this email with the fact that I really don't
understand tramp.  It seems very complicated and hard to debug.  While
I've tried to read and understand tramp, my solutions mostly come from
trail and error.

Since we're talking about tramp now I might as well include the other
tramp patch I have locally as patch #6.  It refactors the ob-shell logic
to fix a test failure I was having with
"ob-shell/remote-with-stdin-or-cmdline".

The branch for dealing with "stdin" gets the shell path by doing
"(with-connection-local-variables shell-file-name)".  According to the info
manual (info-lookup-symbol 'shell-file-name 'emacs-lisp-mode) this will be
"/bin/sh" on remote systems.

The branch for dealing with "shebang" gets the shell path by calling
`org-babel--get-shell-file-name'.  Guix patches that function to point
to the right shell when they package org-mode.  Although looking at the
logic now I can see that guix is very much in the wrong for doing that.
Oh dear.  I'm going to have go tell them to stop doing that.

Regardless I think the refactor might be good?  I'm really not good with tramp
so I'm not sure.  Feel free to skip this patch if you don't like it.  We can
come back to it at a later date.


Ihor Radchenko <[email protected]> writes:

> Morgan Smith <[email protected]> writes:
>
>> +              ;; FIXME: If `temporary-file-directory' is not "/tmp/"
>> +              ;; then we have to tell both org-babel and tramp for our
>> +              ;; tests to pass.  org-babel should probably be able to
>> +              ;; figure this out without any configuration.
>> +              (org-babel-remote-temporary-directory 
>> temporary-file-directory)
>> +              (tramp-methods
>> +               (cons `("mock"
>> +                       (tramp-tmpdir ,temporary-file-directory)
>>                         (tramp-login-program        "sh")
>>                         (tramp-login-args           (("-i")))
>>                         (tramp-remote-shell         "/bin/sh")
>
> Could you elaborate about the fixme?
>

org-babel currently hard-codes (using the defcustom
`org-babel-remote-temporary-directory') the temporary-directory on remote hosts
to "/tmp/".  Ideally, org-babel would by able to determine it at runtime by
checking the remote system.  In order to do this, all org-babel has to do is
call the function '(temporary-file-directory)' which will automatically do all
the magic of finding the right directory whether it be local or remote.

>> After using `add-dir-local-variable', Emacs reformated the file for
>> me.
>
> We need (lisp-data-mode . ((indent-tabs-mode . nil)))
> In the past, lisp data was opened using emacs-lisp-mode, but not in
> newer Emacs.

I was about to say we should let Emacs format ".dir-locals.el" however it wants
and have faith in the Emacs developers but then I found that same snippet in
the ".dir-locals.el" of the emacs's source code itself.  So I have added your
suggested change.

And as usual:

Tests pass after each patch on emacs 30.2.
Tests pass after final patch on emacs 28 and 29 and a recent emacs/master build.
Tests pass after final patch with TZ set to UTC, Europe/Istanbul, and
America/New_York.

>From 8964a144e2dc85c8ed3bba5f5e14321612535f2a Mon Sep 17 00:00:00 2001
From: Morgan Smith <[email protected]>
Date: Wed, 22 Apr 2026 15:29:06 -0400
Subject: [PATCH 1/6] Testing: TRAMP integration: Make work in guix build
 environment

* testing/org-test.el (org-test-with-tramp-remote-dir--worker): Set
`tramp-encoding-shell' and `tramp-remote-path' so that tramp is able
to find a shell.
Set `org-babel-remote-temporary-directory' and `tramp-tmpdir' to
`temporary-file-directory' as the current tests assume these are all
equal.
---
 testing/org-test.el | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/testing/org-test.el b/testing/org-test.el
index ea2c0c8fb..fa295775f 100644
--- a/testing/org-test.el
+++ b/testing/org-test.el
@@ -291,8 +291,22 @@ org-test-with-tramp-remote-dir--worker
      (t (require 'tramp)
         (defvar tramp-methods)
         (defvar tramp-default-host-alist)
-        (let ((tramp-methods
-               (cons '("mock"
+        (defvar tramp-remote-path)
+        (defvar tramp-encoding-shell)
+        (defvar org-babel-remote-temporary-directory)
+        (let (;; In the guix build environment /bin/sh doesn't exist
+              ;; so these two configurations are necessary.
+              (tramp-encoding-shell "sh")
+              (tramp-remote-path (cons 'tramp-own-remote-path
+                                       tramp-remote-path))
+              ;; FIXME: If `temporary-file-directory' is not "/tmp/"
+              ;; then we have to tell both org-babel and tramp for our
+              ;; tests to pass.  org-babel should probably be able to
+              ;; figure this out without any configuration.
+              (org-babel-remote-temporary-directory temporary-file-directory)
+              (tramp-methods
+               (cons `("mock"
+                       (tramp-tmpdir ,temporary-file-directory)
                        (tramp-login-program        "sh")
                        (tramp-login-args           (("-i")))
                        (tramp-remote-shell         "/bin/sh")

base-commit: 004e0828b7758b70ceb0ff47cdd872940c49dcdb
-- 
2.54.0

>From 092b43d33b3907e773008aba547d2c8fe723b577 Mon Sep 17 00:00:00 2001
From: Morgan Smith <[email protected]>
Date: Mon, 20 Apr 2026 13:55:40 -0400
Subject: [PATCH 2/6] Testing: Conditionally skip some tests

* testing/lisp/test-ob-exp.el (ob-exp/exports-inline)
(ob-exp/exports-inline-code, ob-exp/noweb-strip-export-ensure-strips)
(ob-exp/use-case-of-reading-entry-properties): Skip unless we have
loaded the appropriate org babel library.

* testing/lisp/test-ob.el
(test-ob/inline-src_blk-default-results-replace-line-1)
(test-ob/combining-scalar-and-raw-result-types)
(test-ob/just-one-results-block test-ob/nested-code-block)
(test-ob/partial-nested-code-block)
(test-ob/org-babel-results-indented-wrap)
(test-ob/result-file-link-type-header-argument)
(test-ob/result-graphics-link-type-header-argument)
(test-ob/results-in-narrowed-buffer): Skip unless we have loaded the
appropriate org babel library.

* testing/lisp/test-org-fold.el
(test-org-fold/org-fold-display-inline-images): Use the check
"(display-images-p)" instead of "(not noninteractive)".  This test
will fail if it is run on a daemon with no frames.
---
 testing/lisp/test-ob-exp.el   | 4 ++++
 testing/lisp/test-ob.el       | 9 +++++++++
 testing/lisp/test-org-fold.el | 2 +-
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/testing/lisp/test-ob-exp.el b/testing/lisp/test-ob-exp.el
index 3ec63350d..0a617e6af 100644
--- a/testing/lisp/test-ob-exp.el
+++ b/testing/lisp/test-ob-exp.el
@@ -194,6 +194,7 @@ ob-exp/evaluate-all-executables-in-order
 	      (org-test-with-expanded-babel-code *evaluation-collector*))))))
 
 (ert-deftest ob-exp/exports-inline ()
+  (skip-unless (featurep 'ob-shell))
   (should
    (string-match
     (regexp-quote "Here is one in the middle {{{results(=1=)}}} of a line.
@@ -205,6 +206,7 @@ ob-exp/exports-inline
 	(org-test-with-expanded-babel-code (buffer-string)))))))
 
 (ert-deftest ob-exp/exports-inline-code ()
+  (skip-unless (featurep 'ob-shell))
   (should
    (equal "src_emacs-lisp[ :exports code]{(+ 1 1)}"
 	  (org-test-with-temp-text "src_emacs-lisp[:exports code]{(+ 1 1)}"
@@ -320,6 +322,7 @@ ob-exp/export-call-line-information
        (should (string-match "special-token" (buffer-string)))))))
 
 (ert-deftest ob-exp/noweb-strip-export-ensure-strips ()
+  (skip-unless (featurep 'ob-shell))
   (org-test-at-id "8e7bd234-99b2-4b14-8cd6-53945e409775"
     (org-narrow-to-subtree)
     (org-babel-next-src-block 2)
@@ -329,6 +332,7 @@ ob-exp/noweb-strip-export-ensure-strips
       (should-not (string-match (regexp-quote "i=\"10\"") result)))))
 
 (ert-deftest ob-exp/use-case-of-reading-entry-properties ()
+  (skip-unless (featurep 'ob-shell))
   (org-test-at-id "cc5fbc20-bca5-437a-a7b8-2b4d7a03f820"
     (org-narrow-to-subtree)
     (let* ((case-fold-search nil)
diff --git a/testing/lisp/test-ob.el b/testing/lisp/test-ob.el
index 46043caa8..024c30d46 100644
--- a/testing/lisp/test-ob.el
+++ b/testing/lisp/test-ob.el
@@ -359,6 +359,7 @@ test-ob/inline-src-blocks
 	(org-babel-execute-src-block)))))
 
 (ert-deftest test-ob/inline-src_blk-default-results-replace-line-1 ()
+  (skip-unless (featurep 'ob-shell))
   (let ((test-line "src_sh[:results output]{echo 1}")
 	(org-babel-inline-result-wrap "=%s="))
     ;; src_ at bol line 1...
@@ -603,6 +604,7 @@ test-ob/inline-src_blk-wrap
 	(buffer-string))))))
 
 (ert-deftest test-ob/combining-scalar-and-raw-result-types ()
+  (skip-unless (featurep 'ob-shell))
   (org-test-with-temp-text-in-file "
 
 #+begin_src sh :results scalar
@@ -644,6 +646,7 @@ test-ob/no-defaut-value-for-var
 (ert-deftest test-ob/just-one-results-block ()
   "Test that evaluating two times the same code block does not result in a
 duplicate results block."
+  (skip-unless (featurep 'ob-shell))
   (org-test-with-temp-text "#+begin_src sh :results output\necho Hello\n#+end_src\n"
     (org-babel-execute-src-block)
     (org-babel-execute-src-block)     ; second code block execution
@@ -653,6 +656,7 @@ test-ob/just-one-results-block
 
 (ert-deftest test-ob/nested-code-block ()
   "Test nested code blocks inside code blocks don't cause problems."
+  (skip-unless (featurep 'ob-org))
   (should
    (string= "#+begin_src emacs-lisp\n  'foo\n#+end_src"
 	    (org-test-with-temp-text "#+begin_src org :results silent
@@ -666,6 +670,7 @@ test-ob/nested-code-block
 
 (ert-deftest test-ob/partial-nested-code-block ()
   "Test nested code blocks inside code blocks don't cause problems."
+  (skip-unless (featurep 'ob-org))
   (org-test-with-temp-text "#+begin_src org :results silent
   ,#+begin_src emacs-lisp
 #+end_src"
@@ -1222,6 +1227,7 @@ test-ob/org-babel-results-indented-wrap
   "Ensure that wrapped results are inserted correction when indented.
 If not inserted correctly then the second evaluation will fail
 trying to find the :END: marker."
+  (skip-unless (featurep 'ob-shell))
   (org-test-with-temp-text
       "- indented
   #+begin_src sh :results file wrap
@@ -1292,6 +1298,7 @@ test-ob/result-file-link-type-header-argument
   "Ensure that the result is a link to a file.
 The file is just a link to `:file' value.  Inhibit non-empty
 result write to `:file' value."
+  (skip-unless (featurep 'ob-shell))
   (org-test-with-temp-text "
 <point>#+begin_src shell :results value file link :file \"/tmp/test.txt\"
 echo \"hello\" > /tmp/test.txt
@@ -1316,6 +1323,7 @@ test-ob/result-graphics-link-type-header-argument
   "Ensure that the result is a link to a file.
 The file is just a link to `:file' value.  Inhibit non-empty
 result write to `:file' value."
+  (skip-unless (featurep 'ob-shell))
   (org-test-with-temp-text "
 <point>#+begin_src shell :results value file graphics :file \"/tmp/test.txt\"
 echo \"hello\" > /tmp/test.txt
@@ -1658,6 +1666,7 @@ test-ob/results-in-narrowed-buffer
 
 (ert-deftest test-ob/specific-colnames ()
   "Test passing specific column names."
+  (skip-unless (featurep 'ob-shell))
   (should
    (equal "#+name: input-table
 | id | var1 |
diff --git a/testing/lisp/test-org-fold.el b/testing/lisp/test-org-fold.el
index 5633edb36..c39974886 100644
--- a/testing/lisp/test-org-fold.el
+++ b/testing/lisp/test-org-fold.el
@@ -705,7 +705,7 @@ test-org-fold/org-catch-invisible-edits
 
 (ert-deftest test-org-fold/org-fold-display-inline-images ()
   "Test inline images displaying when cycling."
-  (skip-unless (not noninteractive))
+  (skip-unless (display-images-p))
   (let* ((org-cycle-inline-images-display t)
          (images-dir (expand-file-name "examples/images/" org-test-dir))
          (org-logo-image (expand-file-name "Org mode logo mono-color.png" images-dir)))
-- 
2.54.0

>From 06c4ade413763278bbeb41b605ce51e191b6ef5e Mon Sep 17 00:00:00 2001
From: Morgan Smith <[email protected]>
Date: Mon, 20 Apr 2026 15:48:44 -0400
Subject: [PATCH 3/6] Testing: Use the same default ERT test selector
 everywhere

In a couple places we use the test selector "\\(org\\|ob\\)", where as
the test selector in our build system (BTEST_RE) is set to
"\\(org\\|ob\\|ox\\)".  This change ensures the org-export tests are
run in more instances.

* testing/org-test.el (org-test-update-id-locations)
(org-test-run-all-tests): Use the ERT test selector
"\\(org\\|ob\\|ox\\)".
---
 testing/org-test.el | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/testing/org-test.el b/testing/org-test.el
index fa295775f..020f89aef 100644
--- a/testing/org-test.el
+++ b/testing/org-test.el
@@ -484,12 +484,12 @@ org-test-update-id-locations
     "^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*\\.org$")))
 
 (defun org-test-run-batch-tests (&optional org-test-selector)
-  "Run all tests matching an optional regex which defaults to \"\\(org\\|ob\\)\".
+  "Run all tests matching an optional regex which defaults to \"\\(org\\|ob\\|ox\\)\".
 Load all test files first."
   (interactive)
   (let ((org-id-track-globally t)
 	(org-test-selector
-	 (if org-test-selector org-test-selector "\\(org\\|ob\\)"))
+	 (if org-test-selector org-test-selector "\\(org\\|ob\\|ox\\)"))
 	org-confirm-babel-evaluate org-startup-folded vc-handled-backends
         ;; Catch errors in diary sexps better.
         (calendar-debug-sexp t))
@@ -500,7 +500,7 @@ org-test-run-batch-tests
     (ert-run-tests-batch-and-exit org-test-selector)))
 
 (defun org-test-run-all-tests ()
-  "Run all defined tests matching \"\\(org\\|ob\\)\".
+  "Run all defined tests matching \"\\(org\\|ob\\|ox\\)\".
 Load all test files first."
   (interactive)
   (org-test-touch-all-examples)
@@ -508,7 +508,7 @@ org-test-run-all-tests
   (org-test-load)
   (let (;; Catch errors in diary sexps better.
         (calendar-debug-sexp t))
-    (ert "\\(org\\|ob\\)"))
+    (ert "\\(org\\|ob\\|ox\\)"))
   (org-test-kill-all-examples))
 
 (defmacro org-test-at-time (time &rest body)
-- 
2.54.0

>From 607d2046bc1434b67913c463cf0f51bb40c08708 Mon Sep 17 00:00:00 2001
From: Morgan Smith <[email protected]>
Date: Wed, 22 Apr 2026 10:24:23 -0400
Subject: [PATCH 4/6] .dir-locals.el: Set
 `elisp-flymake-byte-compile-load-path' for tests

This will allow flymake to display diagnostics when editing the test
files.

Also set `indent-tabs-mode' to nil in `lisp-data-mode' as well since
newer Emacs open the ".dir-locals.el" file in that mode now.

After using `add-dir-local-variable', Emacs reformated the file for
me.

.dir-locals.el: Set `elisp-flymake-byte-compile-load-path' for the
"testing/lisp" directory.  Set `indent-tabs-mode' for
`lisp-data-mode'.  Reformat.
---
 .dir-locals.el | 33 ++++++++++++++++-----------------
 1 file changed, 16 insertions(+), 17 deletions(-)

diff --git a/.dir-locals.el b/.dir-locals.el
index 9cd2938b0..452ee0432 100644
--- a/.dir-locals.el
+++ b/.dir-locals.el
@@ -1,22 +1,21 @@
-;;; Directory Local Variables            -*- no-byte-compile: t; -*-
+;;; Directory Local Variables            -*- no-byte-compile: t -*-
 ;;; For more information see (info "(emacs) Directory Variables")
 
-((nil
-  (indent-tabs-mode . t)
-  (tab-width . 8)
-  (fill-column . 70)
-  (sentence-end-double-space . t))
- (emacs-lisp-mode
-  (indent-tabs-mode))
- (org-mode
-  (indent-tabs-mode)
-  (org-adapt-indentation)
-  (org-src-content-indentation . 0)
-  (org-footnote-auto-adjust . t)
-  (org-footnote-auto-label . t)
-  (org-footnote-define-inline . nil)
-  (org-footnote-section . "Footnotes")
-  (org-hide-emphasis-markers . nil)))
+((nil . ((indent-tabs-mode . t)
+         (tab-width . 8)
+         (fill-column . 70)
+         (sentence-end-double-space . t)))
+ (emacs-lisp-mode . ((indent-tabs-mode . nil)))
+ (lisp-data-mode . ((indent-tabs-mode . nil)))
+ (org-mode . ((indent-tabs-mode . nil)
+              (org-adapt-indentation . nil)
+              (org-src-content-indentation . 0)
+              (org-footnote-auto-adjust . t)
+              (org-footnote-auto-label . t)
+              (org-footnote-define-inline . nil)
+              (org-footnote-section . "Footnotes")
+              (org-hide-emphasis-markers . nil)))
+ ("testing/lisp" . ((emacs-lisp-mode . ((elisp-flymake-byte-compile-load-path "./" "../../lisp/"))))))
 
 
 
-- 
2.54.0

>From f506b59fd335b56ddd2ffae968df709a4d732b9a Mon Sep 17 00:00:00 2001
From: Morgan Smith <[email protected]>
Date: Sun, 15 Mar 2026 18:47:40 -0400
Subject: [PATCH 5/6] Testing: Require org-test file in our test files

Our build system always loads org-test before running the test so for
all current use-cases this change should have no effect.

This does enable much better flymake errors and makes it easier to run
the test suite outside of the current build system.

* testing/lisp/test-ob-C.el:
* testing/lisp/test-ob-R.el:
* testing/lisp/test-ob-awk.el:
* testing/lisp/test-ob-calc.el:
* testing/lisp/test-ob-clojure.el:
* testing/lisp/test-ob-comint.el:
* testing/lisp/test-ob-csharp.el:
* testing/lisp/test-ob-emacs-lisp.el:
* testing/lisp/test-ob-es.el:
* testing/lisp/test-ob-fortran.el:
* testing/lisp/test-ob-header-arg-defaults.el:
* testing/lisp/test-ob-julia.el:
* testing/lisp/test-ob-lilypond.el:
* testing/lisp/test-ob-lob.el:
* testing/lisp/test-ob-lua.el:
* testing/lisp/test-ob-maxima.el:
* testing/lisp/test-ob-octave.el:
* testing/lisp/test-ob-perl.el:
* testing/lisp/test-ob-plantuml.el:
* testing/lisp/test-ob-python.el:
* testing/lisp/test-ob-ruby.el:
* testing/lisp/test-ob-scheme.el:
* testing/lisp/test-ob-sed.el:
* testing/lisp/test-ob-s.el:
* testing/lisp/test-ob-sql.el:
* testing/lisp/test-ob-sqlite.el:
* testing/lisp/test-ob-table.el:
* testing/lisp/test-ob-tangle.el:
* testing/lisp/test-ob.el:
* testing/lisp/test-oc-basic.el:
* testing/lisp/test-oc.el:
* testing/lisp/test-ol-bbdb.el:
* testing/lisp/test-ol-man.el:
* testing/lisp/test-ol.el:
* testing/lisp/test-org-archive.el:
* testing/lisp/test-org-attach-git.el:
* testing/lisp/test-org-capture.el:
* testing/lisp/test-org-clock.el:
* testing/lisp/test-org-colview.el:
* testing/lisp/test-org-ctags.el:
* testing/lisp/test-org-datetree.el:
* testing/lisp/test-org-duration.el:
* testing/lisp/test-org.el:
* testing/lisp/test-org-feed.el:
* testing/lisp/test-org-fold.el:
* testing/lisp/test-org-info.el:
* testing/lisp/test-org-inlinetask.el:
* testing/lisp/test-org-lint.el:
* testing/lisp/test-org-list.el:
* testing/lisp/test-org-macro.el:
* testing/lisp/test-org-macs.el:
* testing/lisp/test-org-mobile.el:
* testing/lisp/test-org-num.el:
* testing/lisp/test-org-pcomplete.el:
* testing/lisp/test-org-protocol.el:
* testing/lisp/test-org-table.el:
* testing/lisp/test-org-tempo.el:
* testing/lisp/test-org-timer.el:
* testing/lisp/test-org.el:
* testing/lisp/test-ox-ascii.el:
* testing/lisp/test-ox-beamer.el:
* testing/lisp/test-ox-html.el:
* testing/lisp/test-ox-icalendar.el:
* testing/lisp/test-ox-latex.el:
* testing/lisp/test-ox-man.el:
* testing/lisp/test-ox-md.el:
* testing/lisp/test-ox-org.el:
* testing/lisp/test-ox-texinfo.el:
* testing/lisp/test-ox.el:
* testing/lisp/test-property-inheritance.el:
Require 'org-test
---
 testing/lisp/test-ob-C.el                   | 3 +++
 testing/lisp/test-ob-R.el                   | 3 +++
 testing/lisp/test-ob-awk.el                 | 3 +++
 testing/lisp/test-ob-calc.el                | 3 +++
 testing/lisp/test-ob-clojure.el             | 2 ++
 testing/lisp/test-ob-comint.el              | 3 +++
 testing/lisp/test-ob-csharp.el              | 2 ++
 testing/lisp/test-ob-emacs-lisp.el          | 3 +++
 testing/lisp/test-ob-eshell.el              | 3 +++
 testing/lisp/test-ob-fortran.el             | 3 +++
 testing/lisp/test-ob-header-arg-defaults.el | 2 ++
 testing/lisp/test-ob-julia.el               | 3 +++
 testing/lisp/test-ob-lilypond.el            | 3 +++
 testing/lisp/test-ob-lob.el                 | 2 ++
 testing/lisp/test-ob-lua.el                 | 3 +++
 testing/lisp/test-ob-maxima.el              | 2 ++
 testing/lisp/test-ob-octave.el              | 2 ++
 testing/lisp/test-ob-perl.el                | 3 +++
 testing/lisp/test-ob-plantuml.el            | 3 +++
 testing/lisp/test-ob-python.el              | 3 +++
 testing/lisp/test-ob-ruby.el                | 3 +++
 testing/lisp/test-ob-scheme.el              | 2 ++
 testing/lisp/test-ob-sed.el                 | 2 ++
 testing/lisp/test-ob-shell.el               | 3 +++
 testing/lisp/test-ob-sql.el                 | 2 ++
 testing/lisp/test-ob-sqlite.el              | 3 +++
 testing/lisp/test-ob-table.el               | 2 ++
 testing/lisp/test-ob-tangle.el              | 2 ++
 testing/lisp/test-ob.el                     | 2 ++
 testing/lisp/test-oc-basic.el               | 2 ++
 testing/lisp/test-oc.el                     | 2 ++
 testing/lisp/test-ol-bbdb.el                | 2 ++
 testing/lisp/test-ol-man.el                 | 3 +++
 testing/lisp/test-ol.el                     | 2 ++
 testing/lisp/test-org-archive.el            | 2 ++
 testing/lisp/test-org-attach-git.el         | 3 +++
 testing/lisp/test-org-capture.el            | 2 ++
 testing/lisp/test-org-clock.el              | 2 ++
 testing/lisp/test-org-colview.el            | 2 ++
 testing/lisp/test-org-ctags.el              | 2 ++
 testing/lisp/test-org-datetree.el           | 2 ++
 testing/lisp/test-org-duration.el           | 2 ++
 testing/lisp/test-org-element.el            | 2 ++
 testing/lisp/test-org-feed.el               | 2 ++
 testing/lisp/test-org-fold.el               | 2 ++
 testing/lisp/test-org-info.el               | 2 ++
 testing/lisp/test-org-inlinetask.el         | 2 ++
 testing/lisp/test-org-lint.el               | 2 ++
 testing/lisp/test-org-list.el               | 2 ++
 testing/lisp/test-org-macro.el              | 2 ++
 testing/lisp/test-org-macs.el               | 2 ++
 testing/lisp/test-org-mobile.el             | 2 ++
 testing/lisp/test-org-num.el                | 2 ++
 testing/lisp/test-org-pcomplete.el          | 2 ++
 testing/lisp/test-org-protocol.el           | 2 ++
 testing/lisp/test-org-table.el              | 2 ++
 testing/lisp/test-org-tempo.el              | 2 ++
 testing/lisp/test-org-timer.el              | 2 ++
 testing/lisp/test-org.el                    | 2 ++
 testing/lisp/test-ox-ascii.el               | 2 ++
 testing/lisp/test-ox-beamer.el              | 2 ++
 testing/lisp/test-ox-html.el                | 2 ++
 testing/lisp/test-ox-icalendar.el           | 2 ++
 testing/lisp/test-ox-latex.el               | 2 ++
 testing/lisp/test-ox-man.el                 | 2 ++
 testing/lisp/test-ox-md.el                  | 2 ++
 testing/lisp/test-ox-org.el                 | 2 ++
 testing/lisp/test-ox-texinfo.el             | 2 ++
 testing/lisp/test-ox.el                     | 2 ++
 testing/lisp/test-property-inheritance.el   | 3 +++
 70 files changed, 160 insertions(+)

diff --git a/testing/lisp/test-ob-C.el b/testing/lisp/test-ob-C.el
index 737127b02..2a7c40798 100644
--- a/testing/lisp/test-ob-C.el
+++ b/testing/lisp/test-ob-C.el
@@ -23,6 +23,9 @@
 ;;
 
 ;;; Code:
+
+(require 'org-test "../testing/org-test")
+
 (unless (featurep 'ob-C)
   (signal 'missing-test-dependency '("Support for C code blocks")))
 
diff --git a/testing/lisp/test-ob-R.el b/testing/lisp/test-ob-R.el
index b972987b4..01a565715 100644
--- a/testing/lisp/test-ob-R.el
+++ b/testing/lisp/test-ob-R.el
@@ -23,6 +23,9 @@
 ;;
 
 ;;; Code:
+
+(require 'org-test "../testing/org-test")
+
 (org-test-for-executable "R")
 (require 'ob-core)
 (unless (featurep 'ess)
diff --git a/testing/lisp/test-ob-awk.el b/testing/lisp/test-ob-awk.el
index bc492a57a..0b28f44e0 100644
--- a/testing/lisp/test-ob-awk.el
+++ b/testing/lisp/test-ob-awk.el
@@ -23,6 +23,9 @@
 ;;
 
 ;;; Code:
+
+(require 'org-test "../testing/org-test")
+
 (org-test-for-executable "awk")
 (unless (featurep 'ob-awk)
   (signal 'missing-test-dependency '("Support for Awk code blocks")))
diff --git a/testing/lisp/test-ob-calc.el b/testing/lisp/test-ob-calc.el
index c7ca457ae..76455cb0f 100644
--- a/testing/lisp/test-ob-calc.el
+++ b/testing/lisp/test-ob-calc.el
@@ -22,6 +22,9 @@
 ;;
 
 ;;; Code:
+
+(require 'org-test "../testing/org-test")
+
 (require 'ob-calc)
 
 (unless (featurep 'ob-calc)
diff --git a/testing/lisp/test-ob-clojure.el b/testing/lisp/test-ob-clojure.el
index 6ec33fb11..4784f33c6 100644
--- a/testing/lisp/test-ob-clojure.el
+++ b/testing/lisp/test-ob-clojure.el
@@ -24,6 +24,8 @@
 
 ;;; Code:
 
+(require 'org-test "../testing/org-test")
+
 (unless (featurep 'ob-clojure)
   (signal 'missing-test-dependency '("Support for Clojure code blocks")))
 
diff --git a/testing/lisp/test-ob-comint.el b/testing/lisp/test-ob-comint.el
index 7000cfb6c..4f49a027d 100644
--- a/testing/lisp/test-ob-comint.el
+++ b/testing/lisp/test-ob-comint.el
@@ -28,6 +28,9 @@
 
 
 ;;; Code:
+
+(require 'org-test "../testing/org-test")
+
 (ert-deftest test-org-babel-comint/prompt-filter-removes-prompt ()
   "Test that prompt is actually removed."
   (let* ((prompt "org_babel_sh_prompt> ")
diff --git a/testing/lisp/test-ob-csharp.el b/testing/lisp/test-ob-csharp.el
index 1e486c23f..0c87ba0a8 100644
--- a/testing/lisp/test-ob-csharp.el
+++ b/testing/lisp/test-ob-csharp.el
@@ -23,6 +23,8 @@
 
 ;;; Code:
 
+(require 'org-test "../testing/org-test")
+
 (unless (featurep 'ob-csharp)
   (signal 'missing-test-dependency '("Support for C# code blocks")))
 
diff --git a/testing/lisp/test-ob-emacs-lisp.el b/testing/lisp/test-ob-emacs-lisp.el
index 015c1c7ea..27cbe1f36 100644
--- a/testing/lisp/test-ob-emacs-lisp.el
+++ b/testing/lisp/test-ob-emacs-lisp.el
@@ -23,6 +23,9 @@
 ;; Org tests for ob-emacs-lisp.el live here
 
 ;;; Code:
+
+(require 'org-test "../testing/org-test")
+
 (ert-deftest ob-emacs-lisp/commented-last-block-line-no-var ()
   (org-test-with-temp-text-in-file "
 #+begin_src emacs-lisp
diff --git a/testing/lisp/test-ob-eshell.el b/testing/lisp/test-ob-eshell.el
index c4920c09f..f8fffb7d8 100644
--- a/testing/lisp/test-ob-eshell.el
+++ b/testing/lisp/test-ob-eshell.el
@@ -23,6 +23,9 @@
 ;; Template test file for Org tests
 
 ;;; Code:
+
+(require 'org-test "../testing/org-test")
+
 (unless (featurep 'ob-eshell)
   (signal 'missing-test-dependency '("Support for Eshell code blocks")))
 
diff --git a/testing/lisp/test-ob-fortran.el b/testing/lisp/test-ob-fortran.el
index 1d2fe348c..02d16275c 100644
--- a/testing/lisp/test-ob-fortran.el
+++ b/testing/lisp/test-ob-fortran.el
@@ -23,6 +23,9 @@
 ;;
 
 ;;; Code:
+
+(require 'org-test "../testing/org-test")
+
 (org-test-for-executable "gfortran")
 (unless (featurep 'ob-fortran)
   (signal 'missing-test-dependency '("Support for Fortran code blocks")))
diff --git a/testing/lisp/test-ob-header-arg-defaults.el b/testing/lisp/test-ob-header-arg-defaults.el
index c1d9fd443..8babba9ec 100644
--- a/testing/lisp/test-ob-header-arg-defaults.el
+++ b/testing/lisp/test-ob-header-arg-defaults.el
@@ -24,6 +24,8 @@
 
 ;;; Code:
 
+(require 'org-test "../testing/org-test")
+
 (ert-deftest test-ob-header-arg-defaults/global/call ()
   (org-test-at-id "3fdadb69-5d15-411e-aad0-f7860cdd7816"
    (org-babel-next-src-block 1)
diff --git a/testing/lisp/test-ob-julia.el b/testing/lisp/test-ob-julia.el
index 62c58d5a5..34d433a00 100644
--- a/testing/lisp/test-ob-julia.el
+++ b/testing/lisp/test-ob-julia.el
@@ -24,6 +24,9 @@
 ;;
 
 ;;; Code:
+
+(require 'org-test "../testing/org-test")
+
 (org-test-for-executable "julia")
 (require 'ob-core)
 (unless (featurep 'ob-julia)
diff --git a/testing/lisp/test-ob-lilypond.el b/testing/lisp/test-ob-lilypond.el
index 76ccf95b9..3cfe1f5a9 100644
--- a/testing/lisp/test-ob-lilypond.el
+++ b/testing/lisp/test-ob-lilypond.el
@@ -23,6 +23,9 @@
 ;;
 
 ;;; Code:
+
+(require 'org-test "../testing/org-test")
+
 (require 'ob-lilypond)
 
 (defvar org-babel-lilypond-here)
diff --git a/testing/lisp/test-ob-lob.el b/testing/lisp/test-ob-lob.el
index 31c20aab2..984f6235a 100644
--- a/testing/lisp/test-ob-lob.el
+++ b/testing/lisp/test-ob-lob.el
@@ -23,6 +23,8 @@
 
 ;;; Code:
 
+(require 'org-test "../testing/org-test")
+
 (eval-when-compile (require 'cl-lib))
 (require 'ob-lob)
 
diff --git a/testing/lisp/test-ob-lua.el b/testing/lisp/test-ob-lua.el
index 2e67a254b..2c6e1f5bc 100644
--- a/testing/lisp/test-ob-lua.el
+++ b/testing/lisp/test-ob-lua.el
@@ -23,6 +23,9 @@
 ;;
 
 ;;; Code:
+
+(require 'org-test "../testing/org-test")
+
 (unless (featurep 'ob-lua)
   (signal 'missing-test-dependency '("Support for Lua code blocks")))
 
diff --git a/testing/lisp/test-ob-maxima.el b/testing/lisp/test-ob-maxima.el
index 3ab08314a..e0359754b 100644
--- a/testing/lisp/test-ob-maxima.el
+++ b/testing/lisp/test-ob-maxima.el
@@ -23,6 +23,8 @@
 
 ;;; Code:
 
+(require 'org-test "../testing/org-test")
+
 (org-test-for-executable "maxima")
 (unless (featurep 'ob-maxima)
   (signal 'missing-test-dependency '("Support for Maxima code blocks")))
diff --git a/testing/lisp/test-ob-octave.el b/testing/lisp/test-ob-octave.el
index 7cd24f645..f07a59362 100644
--- a/testing/lisp/test-ob-octave.el
+++ b/testing/lisp/test-ob-octave.el
@@ -24,6 +24,8 @@
 
 ;;; Code:
 
+(require 'org-test "../testing/org-test")
+
 (require 'ob-core)
 
 (org-test-for-executable "octave")
diff --git a/testing/lisp/test-ob-perl.el b/testing/lisp/test-ob-perl.el
index e320f0110..591d057ac 100644
--- a/testing/lisp/test-ob-perl.el
+++ b/testing/lisp/test-ob-perl.el
@@ -23,6 +23,9 @@
 ;;
 
 ;;; Code:
+
+(require 'org-test "../testing/org-test")
+
 (org-test-for-executable "perl")
 (unless (featurep 'ob-perl)
   (signal 'missing-test-dependency '("Support for perl code blocks")))
diff --git a/testing/lisp/test-ob-plantuml.el b/testing/lisp/test-ob-plantuml.el
index 851fc20af..8ecd58e77 100644
--- a/testing/lisp/test-ob-plantuml.el
+++ b/testing/lisp/test-ob-plantuml.el
@@ -23,6 +23,9 @@
 ;;
 
 ;;; Code:
+
+(require 'org-test "../testing/org-test")
+
 (require 'ob-plantuml)
 
 (ert-deftest test-ob-plantuml/single-var ()
diff --git a/testing/lisp/test-ob-python.el b/testing/lisp/test-ob-python.el
index 4142a0289..073bac0a4 100644
--- a/testing/lisp/test-ob-python.el
+++ b/testing/lisp/test-ob-python.el
@@ -23,6 +23,9 @@
 ;;
 
 ;;; Code:
+
+(require 'org-test "../testing/org-test")
+
 (org-test-for-executable "python")
 (require 'ob-core)
 (unless (featurep 'ob-python)
diff --git a/testing/lisp/test-ob-ruby.el b/testing/lisp/test-ob-ruby.el
index aecc05b40..ca856a786 100644
--- a/testing/lisp/test-ob-ruby.el
+++ b/testing/lisp/test-ob-ruby.el
@@ -21,6 +21,9 @@
 ;;
 
 ;;; Code:
+
+(require 'org-test "../testing/org-test")
+
 (org-test-for-executable "ruby")
 (unless (featurep 'ob-ruby)
   (signal 'missing-test-dependency '("Support for Ruby code blocks")))
diff --git a/testing/lisp/test-ob-scheme.el b/testing/lisp/test-ob-scheme.el
index 9f3ef3465..1d0a8d257 100644
--- a/testing/lisp/test-ob-scheme.el
+++ b/testing/lisp/test-ob-scheme.el
@@ -23,6 +23,8 @@
 
 ;;; Code:
 
+(require 'org-test "../testing/org-test")
+
 (unless (featurep 'ob-scheme)
   (signal 'missing-test-dependency '("Support for Scheme code blocks")))
 (unless (featurep 'geiser)
diff --git a/testing/lisp/test-ob-sed.el b/testing/lisp/test-ob-sed.el
index d32e067d3..6f5aba31c 100644
--- a/testing/lisp/test-ob-sed.el
+++ b/testing/lisp/test-ob-sed.el
@@ -24,6 +24,8 @@
 
 ;;; Code:
 
+(require 'org-test "../testing/org-test")
+
 (require 'ob-sed)
 (org-test-for-executable "sed")
 (unless (featurep 'ob-sed)
diff --git a/testing/lisp/test-ob-shell.el b/testing/lisp/test-ob-shell.el
index 2b60a8fbf..2f51c9945 100644
--- a/testing/lisp/test-ob-shell.el
+++ b/testing/lisp/test-ob-shell.el
@@ -38,6 +38,9 @@
 
 
 ;;; Code:
+
+(require 'org-test "../testing/org-test")
+
 (ert-deftest test-ob-shell/dont-insert-spaces-on-expanded-bodies ()
   "Expanded shell bodies should not start with a blank line unless
 the body of the tangled block does."
diff --git a/testing/lisp/test-ob-sql.el b/testing/lisp/test-ob-sql.el
index 64c54c188..f8eba9641 100644
--- a/testing/lisp/test-ob-sql.el
+++ b/testing/lisp/test-ob-sql.el
@@ -24,6 +24,8 @@
 
 ;;; Code:
 
+(require 'org-test "../testing/org-test")
+
 (unless (featurep 'ob-sql)
   (signal 'missing-test-dependency '("Support for sql code blocks")))
 
diff --git a/testing/lisp/test-ob-sqlite.el b/testing/lisp/test-ob-sqlite.el
index 88126df6c..a110fb550 100644
--- a/testing/lisp/test-ob-sqlite.el
+++ b/testing/lisp/test-ob-sqlite.el
@@ -23,6 +23,9 @@
 ;;
 
 ;;; Code:
+
+(require 'org-test "../testing/org-test")
+
 (org-test-for-executable "sqlite3")
 (unless (featurep 'ob-sqlite)
   (signal 'missing-test-dependency '("Support for sqlite code blocks")))
diff --git a/testing/lisp/test-ob-table.el b/testing/lisp/test-ob-table.el
index 11d4a8054..d36358a13 100644
--- a/testing/lisp/test-ob-table.el
+++ b/testing/lisp/test-ob-table.el
@@ -24,6 +24,8 @@
 
 ;;; Code:
 
+(require 'org-test "../testing/org-test")
+
 (ert-deftest test-ob-table/sbe ()
   "Test that `sbe' can be used to call code blocks from inside tables."
   (org-test-with-temp-text
diff --git a/testing/lisp/test-ob-tangle.el b/testing/lisp/test-ob-tangle.el
index 493ba7b9b..cdb9c8928 100644
--- a/testing/lisp/test-ob-tangle.el
+++ b/testing/lisp/test-ob-tangle.el
@@ -25,6 +25,8 @@
 
 ;;; Code:
 
+(require 'org-test "../testing/org-test")
+
 (require 'subr-x)
 (require 'ob-tangle)
 (require 'org)
diff --git a/testing/lisp/test-ob.el b/testing/lisp/test-ob.el
index 024c30d46..e94ba6ee3 100644
--- a/testing/lisp/test-ob.el
+++ b/testing/lisp/test-ob.el
@@ -23,6 +23,8 @@
 
 ;;; Code:
 
+(require 'org-test "../testing/org-test")
+
 (require 'ob-core)
 (require 'org-src)
 (require 'ob-ref)
diff --git a/testing/lisp/test-oc-basic.el b/testing/lisp/test-oc-basic.el
index e12e05724..e64a3caa8 100644
--- a/testing/lisp/test-oc-basic.el
+++ b/testing/lisp/test-oc-basic.el
@@ -23,6 +23,8 @@
 
 ;;; Code:
 
+(require 'org-test "../testing/org-test")
+
 (require 'oc-basic)
 
 (defvar org-export-show-temporary-export-buffer)
diff --git a/testing/lisp/test-oc.el b/testing/lisp/test-oc.el
index c194ec186..9efc0ccd8 100644
--- a/testing/lisp/test-oc.el
+++ b/testing/lisp/test-oc.el
@@ -23,6 +23,8 @@
 
 ;;; Code:
 
+(require 'org-test "../testing/org-test")
+
 (require 'oc)
 (require 'ox)
 ;; We need `org-test-with-parsed-data' macro.
diff --git a/testing/lisp/test-ol-bbdb.el b/testing/lisp/test-ol-bbdb.el
index 82e213663..4287df359 100644
--- a/testing/lisp/test-ol-bbdb.el
+++ b/testing/lisp/test-ol-bbdb.el
@@ -24,6 +24,8 @@
 
 ;;; Code:
 
+(require 'org-test "../testing/org-test")
+
 (require 'ol-bbdb)
 
 (ert-deftest test-org-bbdb-anniv-extract-date ()
diff --git a/testing/lisp/test-ol-man.el b/testing/lisp/test-ol-man.el
index 1d34c5961..4be4df49f 100644
--- a/testing/lisp/test-ol-man.el
+++ b/testing/lisp/test-ol-man.el
@@ -23,6 +23,9 @@
 ;; given man page.  These tests exersise that logic.
 
 ;;; Code:
+
+(require 'org-test "../testing/org-test")
+
 (require 'ol-man)
 
 (defun test-org-man/open-fixture (body &optional search)
diff --git a/testing/lisp/test-ol.el b/testing/lisp/test-ol.el
index 371bf1e0f..c8ec09616 100644
--- a/testing/lisp/test-ol.el
+++ b/testing/lisp/test-ol.el
@@ -23,6 +23,8 @@
 
 ;;; Code:
 
+(require 'org-test "../testing/org-test")
+
 (require 'cl-lib)
 (require 'ol)
 (require 'org-id)
diff --git a/testing/lisp/test-org-archive.el b/testing/lisp/test-org-archive.el
index 1e91a7287..ca4287435 100644
--- a/testing/lisp/test-org-archive.el
+++ b/testing/lisp/test-org-archive.el
@@ -23,6 +23,8 @@
 
 ;;; Code:
 
+(require 'org-test "../testing/org-test")
+
 (require 'org-archive)
 
 (ert-deftest test-org-archive/update-status-cookie ()
diff --git a/testing/lisp/test-org-attach-git.el b/testing/lisp/test-org-attach-git.el
index a65418a78..9e262e500 100644
--- a/testing/lisp/test-org-attach-git.el
+++ b/testing/lisp/test-org-attach-git.el
@@ -23,6 +23,9 @@
 ;;
 
 ;;; Code:
+
+(require 'org-test "../testing/org-test")
+
 (org-test-for-executable "git-annex")
 (require 'org-attach-git)
 (require 'cl-lib)
diff --git a/testing/lisp/test-org-capture.el b/testing/lisp/test-org-capture.el
index 80a460434..06177ee46 100644
--- a/testing/lisp/test-org-capture.el
+++ b/testing/lisp/test-org-capture.el
@@ -23,6 +23,8 @@
 
 ;;; Code:
 
+(require 'org-test "../testing/org-test")
+
 (require 'org-capture)
 
 (ert-deftest test-org-capture/fill-template ()
diff --git a/testing/lisp/test-org-clock.el b/testing/lisp/test-org-clock.el
index 4d5cb055e..befd0e3e3 100644
--- a/testing/lisp/test-org-clock.el
+++ b/testing/lisp/test-org-clock.el
@@ -13,6 +13,8 @@
 
 ;;; Code:
 
+(require 'org-test "../testing/org-test")
+
 (require 'org-duration)
 (require 'org-clock)
 
diff --git a/testing/lisp/test-org-colview.el b/testing/lisp/test-org-colview.el
index b801f29bc..4de9c42fa 100644
--- a/testing/lisp/test-org-colview.el
+++ b/testing/lisp/test-org-colview.el
@@ -23,6 +23,8 @@
 
 ;;; Code:
 
+(require 'org-test "../testing/org-test")
+
 ;;; Column view
 
 (require 'cl-lib)
diff --git a/testing/lisp/test-org-ctags.el b/testing/lisp/test-org-ctags.el
index b9695af4a..dce3f5f3a 100644
--- a/testing/lisp/test-org-ctags.el
+++ b/testing/lisp/test-org-ctags.el
@@ -24,6 +24,8 @@
 
 ;;; Code:
 
+(require 'org-test "../testing/org-test")
+
 ;; Alternative implementation for `test-org-ctags/mock-command'
 ;; is required for cmd.exe.
 (unless (string-equal "-c" shell-command-switch)
diff --git a/testing/lisp/test-org-datetree.el b/testing/lisp/test-org-datetree.el
index 6cc6449a2..0ff27e020 100644
--- a/testing/lisp/test-org-datetree.el
+++ b/testing/lisp/test-org-datetree.el
@@ -25,6 +25,8 @@
 
 ;;; Code:
 
+(require 'org-test "../testing/org-test")
+
 (require 'org-datetree)
 
 (ert-deftest test-org-datetree/find-date-create ()
diff --git a/testing/lisp/test-org-duration.el b/testing/lisp/test-org-duration.el
index c4ca4aea6..6a7155f93 100644
--- a/testing/lisp/test-org-duration.el
+++ b/testing/lisp/test-org-duration.el
@@ -23,6 +23,8 @@
 
 ;;; Code:
 
+(require 'org-test "../testing/org-test")
+
 (require 'org-duration)
 
 (ert-deftest test-org-duration/to-minutes ()
diff --git a/testing/lisp/test-org-element.el b/testing/lisp/test-org-element.el
index 73c800ec9..e5ab89ac0 100644
--- a/testing/lisp/test-org-element.el
+++ b/testing/lisp/test-org-element.el
@@ -23,6 +23,8 @@
 
 ;;; Code:
 
+(require 'org-test "../testing/org-test")
+
 (eval-when-compile (require 'cl-lib))
 
 (require 'org-element)
diff --git a/testing/lisp/test-org-feed.el b/testing/lisp/test-org-feed.el
index 83f7ccb09..e59d5bfa8 100644
--- a/testing/lisp/test-org-feed.el
+++ b/testing/lisp/test-org-feed.el
@@ -23,6 +23,8 @@
 
 ;;; Code:
 
+(require 'org-test "../testing/org-test")
+
 (require 'org-feed)
 
 (ert-deftest test-org-feed/fill-template ()
diff --git a/testing/lisp/test-org-fold.el b/testing/lisp/test-org-fold.el
index c39974886..82723a540 100644
--- a/testing/lisp/test-org-fold.el
+++ b/testing/lisp/test-org-fold.el
@@ -23,6 +23,8 @@
 
 ;;; Code:
 
+(require 'org-test "../testing/org-test")
+
 (eval-when-compile (require 'cl-lib))
 
 
diff --git a/testing/lisp/test-org-info.el b/testing/lisp/test-org-info.el
index 75dbc774d..1a80c05f8 100644
--- a/testing/lisp/test-org-info.el
+++ b/testing/lisp/test-org-info.el
@@ -23,6 +23,8 @@
 
 ;;; Code:
 
+(require 'org-test "../testing/org-test")
+
 (require 'ol-info)
 
 (ert-deftest test-org-info/export ()
diff --git a/testing/lisp/test-org-inlinetask.el b/testing/lisp/test-org-inlinetask.el
index 4670af57a..480c3cffe 100644
--- a/testing/lisp/test-org-inlinetask.el
+++ b/testing/lisp/test-org-inlinetask.el
@@ -22,6 +22,8 @@
 
 ;;; Code:
 
+(require 'org-test "../testing/org-test")
+
 (require 'org-inlinetask)
 
 
diff --git a/testing/lisp/test-org-lint.el b/testing/lisp/test-org-lint.el
index 9c2e5bf7a..36f3a0438 100644
--- a/testing/lisp/test-org-lint.el
+++ b/testing/lisp/test-org-lint.el
@@ -23,6 +23,8 @@
 
 ;;; Code:
 
+(require 'org-test "../testing/org-test")
+
 (require 'org-footnote)
 (require 'org-lint)
 
diff --git a/testing/lisp/test-org-list.el b/testing/lisp/test-org-list.el
index ae99f7cc0..1da621143 100644
--- a/testing/lisp/test-org-list.el
+++ b/testing/lisp/test-org-list.el
@@ -23,6 +23,8 @@
 
 ;;; Code:
 
+(require 'org-test "../testing/org-test")
+
 (require 'org-list)
 (require 'org)
 
diff --git a/testing/lisp/test-org-macro.el b/testing/lisp/test-org-macro.el
index 69b8f5c09..640dbddbe 100644
--- a/testing/lisp/test-org-macro.el
+++ b/testing/lisp/test-org-macro.el
@@ -23,6 +23,8 @@
 
 ;;; Code:
 
+(require 'org-test "../testing/org-test")
+
 
 ;;; Macros
 
diff --git a/testing/lisp/test-org-macs.el b/testing/lisp/test-org-macs.el
index bfd2b62ea..015668fc8 100644
--- a/testing/lisp/test-org-macs.el
+++ b/testing/lisp/test-org-macs.el
@@ -23,6 +23,8 @@
 
 ;;; Code:
 
+(require 'org-test "../testing/org-test")
+
 
 ;;; String manipulation
 
diff --git a/testing/lisp/test-org-mobile.el b/testing/lisp/test-org-mobile.el
index 7b9275824..5aa67bb35 100644
--- a/testing/lisp/test-org-mobile.el
+++ b/testing/lisp/test-org-mobile.el
@@ -25,6 +25,8 @@
 
 ;;; Code:
 
+(require 'org-test "../testing/org-test")
+
 (require 'org-mobile)
 
 (ert-deftest test-org-mobile/org-mobile-edit ()
diff --git a/testing/lisp/test-org-num.el b/testing/lisp/test-org-num.el
index 70b03a7d8..70f7e229c 100644
--- a/testing/lisp/test-org-num.el
+++ b/testing/lisp/test-org-num.el
@@ -25,6 +25,8 @@
 
 ;;; Code:
 
+(require 'org-test "../testing/org-test")
+
 (require 'org-num)
 
 (ert-deftest test-org-num/face ()
diff --git a/testing/lisp/test-org-pcomplete.el b/testing/lisp/test-org-pcomplete.el
index 1a90c43b8..ee36f7a27 100644
--- a/testing/lisp/test-org-pcomplete.el
+++ b/testing/lisp/test-org-pcomplete.el
@@ -24,6 +24,8 @@
 
 ;;; Code:
 
+(require 'org-test "../testing/org-test")
+
 (require 'org)
 
 (ert-deftest test-org-pcomplete/clocktable ()
diff --git a/testing/lisp/test-org-protocol.el b/testing/lisp/test-org-protocol.el
index 90a8869d6..e3c5b5e1c 100644
--- a/testing/lisp/test-org-protocol.el
+++ b/testing/lisp/test-org-protocol.el
@@ -24,6 +24,8 @@
 
 ;;; Code:
 
+(require 'org-test "../testing/org-test")
+
 (require 'cl-lib)
 (require 'org-protocol)
 (require 'org-capture)
diff --git a/testing/lisp/test-org-table.el b/testing/lisp/test-org-table.el
index 2d111ae7e..5da95e4f3 100644
--- a/testing/lisp/test-org-table.el
+++ b/testing/lisp/test-org-table.el
@@ -27,6 +27,8 @@
 
 ;;; Code:
 
+(require 'org-test "../testing/org-test")
+
 (require 'org-table)  ; `org-table-make-reference'
 (require 'ox)
 
diff --git a/testing/lisp/test-org-tempo.el b/testing/lisp/test-org-tempo.el
index 324445062..af0cd795e 100644
--- a/testing/lisp/test-org-tempo.el
+++ b/testing/lisp/test-org-tempo.el
@@ -25,6 +25,8 @@
 
 ;;; Code:
 
+(require 'org-test "../testing/org-test")
+
 (require 'org-tempo)
 
 (unless (featurep 'org-tempo)
diff --git a/testing/lisp/test-org-timer.el b/testing/lisp/test-org-timer.el
index beba53cfd..1e4463f06 100644
--- a/testing/lisp/test-org-timer.el
+++ b/testing/lisp/test-org-timer.el
@@ -25,6 +25,8 @@
 
 ;;; Code:
 
+(require 'org-test "../testing/org-test")
+
 (eval-when-compile (require 'cl-lib))
 (require 'org-timer)
 
diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el
index c019d4f3d..4ba7aa560 100644
--- a/testing/lisp/test-org.el
+++ b/testing/lisp/test-org.el
@@ -24,6 +24,8 @@
 
 ;;; Code:
 
+(require 'org-test "../testing/org-test")
+
 (eval-when-compile (require 'cl-lib))
 (eval-when-compile (require 'org-macs)) ;For `org-with-gensyms'.
 (require 'org)
diff --git a/testing/lisp/test-ox-ascii.el b/testing/lisp/test-ox-ascii.el
index 07f9b0580..0fb259b57 100644
--- a/testing/lisp/test-ox-ascii.el
+++ b/testing/lisp/test-ox-ascii.el
@@ -23,6 +23,8 @@
 
 ;;; Code:
 
+(require 'org-test "../testing/org-test")
+
 (require 'ox-ascii nil t)
 (unless (featurep 'ox-ascii)
   (signal 'missing-test-dependency '("org-export-ascii")))
diff --git a/testing/lisp/test-ox-beamer.el b/testing/lisp/test-ox-beamer.el
index 24550ec62..b75bd7096 100644
--- a/testing/lisp/test-ox-beamer.el
+++ b/testing/lisp/test-ox-beamer.el
@@ -23,6 +23,8 @@
 
 ;;; Code:
 
+(require 'org-test "../testing/org-test")
+
 (require 'ox-beamer nil t)
 (unless (featurep 'ox-beamer)
   (signal 'missing-test-dependency '("org-export-beamer")))
diff --git a/testing/lisp/test-ox-html.el b/testing/lisp/test-ox-html.el
index 82e11f472..11da941ab 100644
--- a/testing/lisp/test-ox-html.el
+++ b/testing/lisp/test-ox-html.el
@@ -25,6 +25,8 @@
 
 ;;; Code:
 
+(require 'org-test "../testing/org-test")
+
 (require 'ox-html)
 
 
diff --git a/testing/lisp/test-ox-icalendar.el b/testing/lisp/test-ox-icalendar.el
index d2d518a9f..ea193f682 100644
--- a/testing/lisp/test-ox-icalendar.el
+++ b/testing/lisp/test-ox-icalendar.el
@@ -23,6 +23,8 @@
 
 ;;; Code:
 
+(require 'org-test "../testing/org-test")
+
 (require 'ox-icalendar)
 
 (ert-deftest test-ox-icalendar/crlf-endings ()
diff --git a/testing/lisp/test-ox-latex.el b/testing/lisp/test-ox-latex.el
index 0664a2478..584164f91 100644
--- a/testing/lisp/test-ox-latex.el
+++ b/testing/lisp/test-ox-latex.el
@@ -23,6 +23,8 @@
 
 ;;; Code:
 
+(require 'org-test "../testing/org-test")
+
 (require 'ox-latex nil t)
 (unless (featurep 'ox-latex)
   (signal 'missing-test-dependency '("org-export-latex")))
diff --git a/testing/lisp/test-ox-man.el b/testing/lisp/test-ox-man.el
index 5b21a8216..185b08e90 100644
--- a/testing/lisp/test-ox-man.el
+++ b/testing/lisp/test-ox-man.el
@@ -23,6 +23,8 @@
 
 ;;; Code:
 
+(require 'org-test "../testing/org-test")
+
 (require 'ox-man)
 
 (defvar ox-man/groff-executable (executable-find "groff")
diff --git a/testing/lisp/test-ox-md.el b/testing/lisp/test-ox-md.el
index 3f6ffc05a..e1e1e4e2d 100644
--- a/testing/lisp/test-ox-md.el
+++ b/testing/lisp/test-ox-md.el
@@ -23,6 +23,8 @@
 
 ;;; Code:
 
+(require 'org-test "../testing/org-test")
+
 (require 'ox-md)
 
 (ert-deftest ox-md/footnotes-level ()
diff --git a/testing/lisp/test-ox-org.el b/testing/lisp/test-ox-org.el
index 08a5f989c..ef500b789 100644
--- a/testing/lisp/test-ox-org.el
+++ b/testing/lisp/test-ox-org.el
@@ -23,6 +23,8 @@
 
 ;;; Code:
 
+(require 'org-test "../testing/org-test")
+
 (require 'ox-org)
 
 (ert-deftest ox-org/honor-export-snippets ()
diff --git a/testing/lisp/test-ox-texinfo.el b/testing/lisp/test-ox-texinfo.el
index 4ba9825b0..6fd21e9af 100644
--- a/testing/lisp/test-ox-texinfo.el
+++ b/testing/lisp/test-ox-texinfo.el
@@ -25,6 +25,8 @@
 
 ;;; Code:
 
+(require 'org-test "../testing/org-test")
+
 (require 'cl-lib)
 (require 'ox-texinfo)
 
diff --git a/testing/lisp/test-ox.el b/testing/lisp/test-ox.el
index fcaab4fbe..79365ad29 100644
--- a/testing/lisp/test-ox.el
+++ b/testing/lisp/test-ox.el
@@ -25,6 +25,8 @@
 
 ;;; Code:
 
+(require 'org-test "../testing/org-test")
+
 (require 'cl-lib)
 (require 'ox)
 (require 'org-inlinetask)
diff --git a/testing/lisp/test-property-inheritance.el b/testing/lisp/test-property-inheritance.el
index b7aede854..ecfe9398e 100644
--- a/testing/lisp/test-property-inheritance.el
+++ b/testing/lisp/test-property-inheritance.el
@@ -23,6 +23,9 @@
 ;;
 
 ;;; Code:
+
+(require 'org-test "../testing/org-test")
+
 (defmacro test-org-in-property-buffer (&rest body)
   `(with-temp-buffer
      (insert-file-contents (expand-file-name "property-inheritance.org"
-- 
2.54.0

>From b5ef2effd4b29ffe051b8182b2231cabe6f3d8d3 Mon Sep 17 00:00:00 2001
From: Morgan Smith <[email protected]>
Date: Wed, 22 Apr 2026 15:22:56 -0400
Subject: [PATCH 6/6] ob-shell.el: Refactor

* lisp/ob-shell.el (org-babel-sh-evaluate): Combine the cases for a
shell script together.
---
 lisp/ob-shell.el | 54 +++++++++++++-----------------------------------
 1 file changed, 14 insertions(+), 40 deletions(-)

diff --git a/lisp/ob-shell.el b/lisp/ob-shell.el
index e3767ac06..c3e6027c0 100644
--- a/lisp/ob-shell.el
+++ b/lisp/ob-shell.el
@@ -338,6 +338,7 @@ org-babel-sh-evaluate
 of the statements in BODY, if RESULT-TYPE equals `value' then
 return the value of the last statement in BODY."
   (let* ((shebang (cdr (assq :shebang params)))
+         (shebang (and (org-string-nw-p shebang) shebang))
          (async (org-babel-comint-use-async params))
 	 (results-params (cdr (assq :result-params params)))
 	 (value-is-exit-status
@@ -347,34 +348,24 @@ org-babel-sh-evaluate
 	      (member "value" results-params)))
 	 (results
 	  (cond
-	   ((or stdin cmdline)	       ; external shell script w/STDIN
-	    (let ((script-file (org-babel-temp-file "sh-script-"))
-		  (stdin-file (org-babel-temp-file "sh-stdin-"))
-		  (padline (not (string= "no" (cdr (assq :padline params))))))
-	      (with-temp-file script-file
-		(if shebang
+           ((or stdin cmdline shebang) ; external shell script
+            (let ((script-file (org-babel-temp-file "sh-script-"))
+                  (padline (not (string= "no" (cdr (assq :padline params)))))
+                  (stdin (or stdin "")))
+              (with-temp-file script-file
+                (if shebang
                     (insert shebang "\n")
                   ;; Provide shell name explicitly.
                   ;; This is necessary because running, for example,
                   ;; dash script-for-dash.sh will use /bin/sh.
                   (insert (format "#!/usr/bin/env %s" shell-file-name) "\n"))
-		(when padline (insert "\n"))
-		(insert body))
-	      (set-file-modes script-file #o755)
-	      (with-temp-file stdin-file (insert (or stdin "")))
-	      (with-temp-buffer
-                (with-connection-local-variables
-                 ;; `with-connection-local-variables' will override
-                 ;; `shell-file-name' and `shell-command-swtich' as
-                 ;; needed for the remote connection.
-                 (apply #'process-file
-                        shell-file-name
-		        stdin-file
-                        (current-buffer)
-                        nil
-                        (list shell-command-switch
-                              (concat (file-local-name script-file)  " " (format "%s" cmdline)))))
-		(buffer-string))))
+                (when padline (insert "\n"))
+                (insert body))
+              (set-file-modes script-file #o755)
+              (org-babel-eval
+               (concat (file-local-name script-file)
+                       (if cmdline (format " %s" cmdline) ""))
+               stdin)))
 	   (session			; session evaluation
             (if async
                 (progn
@@ -407,23 +398,6 @@ org-babel-sh-evaluate
                  ;; Remove `org-babel-sh-eoe-indicator' output line.
 	         1))
 	       "\n")))
-	   ;; External shell script, with or without a predefined
-	   ;; shebang.
-	   ((org-string-nw-p shebang)
-	    (let ((script-file (org-babel-temp-file "sh-script-"))
-		  (padline (not (equal "no" (cdr (assq :padline params))))))
-	      (with-temp-file script-file
-		(insert shebang "\n")
-		(when padline (insert "\n"))
-		(insert body))
-	      (set-file-modes script-file #o755)
-              (if (file-remote-p script-file)
-                  ;; Run remote script using its local path as COMMAND.
-                  ;; The remote execution is ensured by setting
-                  ;; correct `default-directory'.
-                  (let ((default-directory (file-name-directory script-file)))
-                    (org-babel-eval (file-local-name script-file) ""))
-	        (org-babel-eval script-file ""))))
 	   (t (org-babel-eval shell-file-name (org-trim body))))))
     (when (and results value-is-exit-status)
       (setq results (car (reverse (split-string results "\n" t)))))
-- 
2.54.0

Reply via email to