-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
project.clj, moves dev/test dependencies into :repl/:dev profiles.
moves 'test' from 'main' into repl/strongbox/user.clj. core.clj, replaces bz2 compressed catalogue with a simple string. two reasons: 1. it wasn't working at compile time like I thought. 2. regular strings are more compressible ultimately when building an AppImage.
- Loading branch information
Torkus
committed
Apr 2, 2023
1 parent
ced25d7
commit 54eb7fb
Showing
8 changed files
with
103 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
(ns strongbox.user | ||
(:refer-clojure :rename {test clj-test}) | ||
(:require | ||
[taoensso.timbre :as timbre :refer [spy info warn error report]] | ||
[clojure.test] | ||
[clojure.tools.namespace.repl :as tn :refer [refresh]] | ||
[strongbox | ||
[main :as main] | ||
[catalogue :as catalogue] | ||
[http :as http] | ||
[core :as core] | ||
[utils :as utils :refer [in?]] | ||
;;[cli :as cli] | ||
] | ||
[gui.diff :refer [with-gui-diff]] | ||
)) | ||
|
||
(defn test | ||
[& [ns-kw fn-kw]] | ||
(main/stop) | ||
(clojure.tools.namespace.repl/refresh) ;; reloads all namespaces, including strongbox.whatever-test ones | ||
(utils/instrument true) ;; always test with spec checking ON | ||
|
||
(try | ||
;; note! remember to update `cloverage.clj` with any new bindings | ||
(with-redefs [core/*testing?* true | ||
http/*default-pause* 1 ;; ms | ||
http/*default-attempts* 1 | ||
;; don't pause while testing. nothing should depend on that pause happening. | ||
;; note! this is different to `joblib/tick-delay` not delaying when `joblib/*tick*` is unbound. | ||
;; tests still bind `joblib/*tick*` and run things in parallel. | ||
;;joblib/tick-delay joblib/*tick* | ||
;;main/*spec?* true | ||
;;cli/install-update-these-in-parallel cli/install-update-these-serially | ||
;;core/check-for-updates core/check-for-updates-serially | ||
;; for testing purposes, no addon host is disabled | ||
catalogue/host-disabled? (constantly false)] | ||
(core/reset-logging!) | ||
|
||
(if ns-kw | ||
(if (some #{ns-kw} [:main :utils :http | ||
:core :toc :nfo :zip :config :catalogue :addon :logging :joblib | ||
:cli :gui :jfx | ||
:curseforge-api :wowinterface-api :gitlab-api :github-api :tukui-api | ||
:release-json]) | ||
(with-gui-diff | ||
(if fn-kw | ||
;; `test-vars` will run the test but not give feedback if test passes OR test not found | ||
;; slightly better than nothing | ||
(clojure.test/test-vars [(resolve (symbol (str "strongbox." (name ns-kw) "-test") (name fn-kw)))]) | ||
(clojure.test/run-all-tests (re-pattern (str "strongbox." (name ns-kw) "-test")))) | ||
) | ||
(error "unknown test file:" ns-kw)) | ||
(clojure.test/run-all-tests #"strongbox\..*-test"))) | ||
(finally | ||
;; use case: we run the tests from the repl and afterwards we call `restart` to start the app. | ||
;; `stop` inside `restart` will be outside of `with-redefs` and still have logging `:min-level` set to `:debug` | ||
;; it will dump a file and yadda yadda. | ||
(core/reset-logging!)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters