babashka / process

Clojure library for shelling out / spawning sub-processes
Eclipse Public License 1.0
220 stars 29 forks source link

Add test support for `exec` #131

Closed lread closed 1 year ago

lread commented 1 year ago

New bb tasks:

CI:

Add run_exec.clj - a wee program to exercise exec

Test utilities moved to babashka.process.test-utils so that they can be used by existing babashka.process-test and new:

Add :ps-me to wee dummy wd.clj to support exec arg0 testing for macOS and Linux.

Add doc/dev.md with some relevant notes/pointers.

Other changes:

Bugs found and fixed as a result of testing:

Closes #117, Fixes #123

lread commented 1 year ago

Another biggie. Lemme know watcha think. As always, happy to collab and adapt.

After merge into babashka, we can adjust this:

;;;; babashka.process
;; test built-in babashka.process
(test-namespaces 'babashka.process-test)

;; test babashka.process from source
#_{:clj-kondo/ignore [:duplicate-require]}
(require '[babashka.process] :reload)
(test-namespaces 'babashka.process-test)

To maybe something like this:

;;;; babashka.process
;; test built-in babashka.process
(test-namespaces 'babashka.process-test)

(when (= "native" (System/getenv "BABASHKA_TEST_ENV"))
  ;; test babashka.process from source
  #_{:clj-kondo/ignore [:duplicate-require]}
  (require '[babashka.process] :reload)
  (System/setProperty "babashka.process.test.reload" "true")
  (test-namespaces 'babashka.process-test 'babashka.process-exec-test))
borkdude commented 1 year ago

I'll look at this soon, but I'm on a trip so it'll take a few days

On Tue, May 23, 2023 at 12:27 AM Lee Read @.***> wrote:

Another biggie. Lemme know watcha think. As always, happy to collab and adapt.

After merge into babashka, we can adjust this https://github.com/babashka/babashka/blob/0f85b02a82d4033f6b9cb697ec0e6919e7e0281b/test-resources/lib_tests/babashka/run_all_libtests.clj#L95-L102 :

;;;; babashka.process;; test built-in babashka.process (test-namespaces 'babashka.process-test) ;; test babashka.process from source

_{:clj-kondo/ignore [:duplicate-require]}

(require '[babashka.process] :reload) (test-namespaces 'babashka.process-test)

To maybe something like this:

;;;; babashka.process;; test built-in babashka.process (test-namespaces 'babashka.process-test)

(when (= "native" (System/getenv "BABASHKA_TEST_ENV")) ;; test babashka.process from source

_{:clj-kondo/ignore [:duplicate-require]}

(require '[babashka.process] :reload) (System/setProperty "babashka.process.test.reload" "true") (test-namespaces 'babashka.process-test 'babashka.process-exec-test))

— Reply to this email directly, view it on GitHub https://github.com/babashka/process/pull/131#issuecomment-1558113387, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACFSBXNWVKWLJMNXXVH4G3XHPR57ANCNFSM6AAAAAAYLA3SUE . You are receiving this because you are subscribed to this thread.Message ID: @.***>

-- https://www.michielborkent.nl https://www.eetvoorjeleven.nu

lread commented 1 year ago

I'll look at this soon, but I'm on a trip so it'll take a few days

Thanks for the ping! Enjoy your trip!

borkdude commented 1 year ago

Thanks!