From 9caedae0fe5d619651f8b54fa669cec363475fef Mon Sep 17 00:00:00 2001 From: Milt Reder Date: Thu, 2 Sep 2021 17:59:14 -0400 Subject: [PATCH 1/4] take clone args in fixture --- src/main/com/yetanalytics/lrs/test_runner.clj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/com/yetanalytics/lrs/test_runner.clj b/src/main/com/yetanalytics/lrs/test_runner.clj index 9525aa5..e0c2dbe 100644 --- a/src/main/com/yetanalytics/lrs/test_runner.clj +++ b/src/main/com/yetanalytics/lrs/test_runner.clj @@ -186,9 +186,9 @@ (defn test-suite-fixture "Fixture to ensure clean test environment." - [f] + [f & clone-args] (binding [*current-test-suite-dir* - (some-> (clone-test-suite) + (some-> (apply clone-test-suite clone-args) install-test-suite!)] (try (f) From 3e95c3ffbcce5769413cd12860318615be680b4f Mon Sep 17 00:00:00 2001 From: Milton Reder Date: Tue, 26 Aug 2025 10:47:09 -0400 Subject: [PATCH 2/4] version of with-test-suite that takes args --- src/main/com/yetanalytics/lrs/test_runner.clj | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/main/com/yetanalytics/lrs/test_runner.clj b/src/main/com/yetanalytics/lrs/test_runner.clj index e0c2dbe..8df6373 100644 --- a/src/main/com/yetanalytics/lrs/test_runner.clj +++ b/src/main/com/yetanalytics/lrs/test_runner.clj @@ -182,6 +182,18 @@ (finally (delete-test-suite! *current-test-suite-dir*))))) +(defmacro with-test-suite-args + "Do things with a test suite and clean it up, taking a map of clone args + as the first argument." + [argm & body] + `(binding [*current-test-suite-dir* + (some-> (apply clone-test-suite (-> argm seq flatten)) + install-test-suite!)] + (try + ~@body + (finally + (delete-test-suite! *current-test-suite-dir*))))) + ;; or fixture (defn test-suite-fixture From 1891bb5c8802a397ffaee86d336ee95d71cc1a4d Mon Sep 17 00:00:00 2001 From: Milton Reder Date: Tue, 26 Aug 2025 10:51:20 -0400 Subject: [PATCH 3/4] milt remembers how to write macros: --- src/main/com/yetanalytics/lrs/test_runner.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/com/yetanalytics/lrs/test_runner.clj b/src/main/com/yetanalytics/lrs/test_runner.clj index 8df6373..c00bfd3 100644 --- a/src/main/com/yetanalytics/lrs/test_runner.clj +++ b/src/main/com/yetanalytics/lrs/test_runner.clj @@ -187,7 +187,7 @@ as the first argument." [argm & body] `(binding [*current-test-suite-dir* - (some-> (apply clone-test-suite (-> argm seq flatten)) + (some-> (clone-test-suite ~@(-> argm seq flatten)) install-test-suite!)] (try ~@body From 85fe3375b5fd0fa180e352492a45095c7ff0e226 Mon Sep 17 00:00:00 2001 From: Milton Reder Date: Mon, 15 Sep 2025 10:32:04 -0400 Subject: [PATCH 4/4] update docs --- README.md | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f61f9bd..7d90ab6 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,20 @@ The tests show the 3 basic ways to use this: (stop-fn) (is (true? ret))))) -;; fixture ;; (use-fixtures :once test-suite-fixture) +(deftest with-test-suite-args-test + (with-test-suite-args + {:branch "some-branch"} + (let [stop-fn (run-lrs) + ret (conformant? "-e" "http://localhost:8080/xapi" "-b" "-z")] + (stop-fn) + (is (true? ret))))) + +;; fixture ;; + +(use-fixtures :once test-suite-fixture) +;; or +(use-fixtures :once #(test-suite-fixture % :branch "some-branch")) + (deftest test-suite-fixture-test (test-suite-fixture #(let [stop-fn (run-lrs) @@ -41,6 +54,12 @@ The tests show the 3 basic ways to use this: ``` +### Options + +The following options are available: +* git-uri - an alternate source for the conformance tests, defaults to https://github.com/adlnet/lrs-conformance-test-suite.git +* branch - an alternate branch, defaults to `master` + ## Roadmap This is basically a port of what `lrs` does, and assumes a working node/npm environment.