This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-10-03
Channels
- # announcements (4)
- # aws (19)
- # babashka (55)
- # beginners (40)
- # biff (4)
- # calva (9)
- # cherry (3)
- # cider (8)
- # clj-kondo (26)
- # clj-yaml (3)
- # clojure (92)
- # clojure-austin (14)
- # clojure-europe (21)
- # clojure-nl (1)
- # clojure-norway (5)
- # clojure-portugal (3)
- # clojure-uk (2)
- # clojurescript (48)
- # conjure (19)
- # datalevin (14)
- # docker (13)
- # emacs (3)
- # fulcro (21)
- # gratitude (14)
- # improve-getting-started (1)
- # introduce-yourself (2)
- # joker (4)
- # juxt (2)
- # lsp (12)
- # malli (5)
- # meander (17)
- # off-topic (13)
- # re-frame (7)
- # scittle (2)
- # test-check (2)
what is the easiest way to pass an options map in bb script (should not be a one liner so not (slurp *input*)
. Do I say (read-string read-line
)
Maybe using https://github.com/babashka/cli here is nicer? can do it like cli command :opt1 v1 :opt2 v2
which is technically a map 😛
Hi babashka folks, I am following the Book on how to https://book.babashka.org/#_running_tests I was wondering if there is a way to explore the loaded namespaces and required them dynamically instead of listing all of them there one by one?
Also found https://github.com/madis/clojure-monorepo-sandbox/blob/37a3d4a36d90ee3435543071ffaf5b08b1d6c9a0/bin_test/test_runner.clj#L11-L24 in the wild :D
@richiardiandrea In the README of https://github.com/babashka/tools.namespace you can see how to run cognitect test runner with bb which does auto-discovery of namespaces
cool let me check that, thank you!
@U04V15CAJ I get an error but it might be on me, can I enable more verbosity for:
Running tests in #{"test"}
----- Error --------------------------------------------------------------------
Type: java.lang.Exception
Message: Unable to resolve classname: clojure.lang.Var
It seems to try and run the testsor what would be the best course of action for debugging here?
@richiardiandrea which version of bb is this?
$ bb --version
babashka v0.8.156
ok sounds good will do
oh that's better, I think I might have a problem with spec-tools
Running tests in #{"test"}
----- Error --------------------------------------------------------------------
Type: clojure.lang.ExceptionInfo
Message: defrecord/deftypecurrently only support protocol implementations, found: IFn
Data: {:type :sci/error, :line nil, :column nil, :file "spec_tools/core.cljc"}
Location: spec_tools/core.cljc:396:1
Phase: macroexpand
----- Context ------------------------------------------------------------------
392: (if (sequential? type)
393: (update spec :type (comp first second))
394: spec)))
395:
396: (defrecord Spec [spec form type]
^--- defrecord/deftypecurrently only support protocol implementations, found: IFn
397: #?@(:clj [s/Specize
398: (specize* [s] s)
399: (specize* [s _] s)])
400:
401: Coercion
----- Stack trace --------------------------------------------------------------
clojure.core/defrecord - <built-in>
spec-tools.core/dorun - spec_tools/core.cljc:396:1
spec-tools.core - spec_tools/core.cljc:396:1
spec-tools.data-spec - spec_tools/data_spec.cljc:4:3
acuity.core3.models.clinical-configuration.contrast-agent-definition - /home/cokap/git/cohesic/acuity/domain/src/acuity/core3/models/clinical_configuration/contrast_agent_definition.clj:2:3
... (run with --debug to see elided elements)
cognitect.test-runner/test - /home/cokap/.gitlibs/libs/io.github.cognitect-labs/test-runner/dfb30dd6605cb6c0efc275e1df1736f6e90d4d73/src/cognitect/test_runner.clj:71:5
cognitect.test-runner/test - /home/cokap/.gitlibs/libs/io.github.cognitect-labs/test-runner/dfb30dd6605cb6c0efc275e1df1736f6e90d4d73/src/cognitect/test_runner.clj:62:1
cognitect.test-runner - /home/cokap/.gitlibs/libs/io.github.cognitect-labs/test-runner/dfb30dd6605cb6c0efc275e1df1736f6e90d4d73/src/cognitect/test_runner.clj:127:38
clojure.core/apply - <built-in>
user-b15184f8-c0ef-401d-bbb1-7af7bd7ef751 - <expr>:26:1
although IFn
on a record seems to common, perhaps SCI could make a special case for that or so
ok yeah if that is something you'd consider adding - it's nice, I could even look into that.
Or I'll port those data specs to malli
, these are my two options
uhm...then I'd need a malli
to spec converted...uhm...
What I would try if I were you is fork spec-tools and try if it runs in bb without the IFn: https://github.com/metosin/spec-tools/blob/d15ec93049c3c1e843aff171295c8e47253afa0a/src/spec_tools/core.cljc#L482 Because there might be more after that
ok trying
Oh found another one in
Type: java.lang.Exception
Message: Unable to resolve classname: java.lang.ref.SoftReference
Location: clojure/core/cache.clj:13:3
----- Context ------------------------------------------------------------------
9: (ns ^{:doc "A caching library for Clojure."
10: :author "Fogus"}
11: clojure.core.cache
12: (:require clojure.data.priority-map)
13: (:import (java.lang.ref ReferenceQueue SoftReference)
^--- Unable to resolve classname: java.lang.ref.SoftReference
14: (java.util.concurrent ConcurrentHashMap)))
15:
16: (set! *warn-on-reflection* true)
17:
18: ;; # Protocols and Types
seems like a too deep of a rabbit hole 😄
I got rid of the call to core.memoize
and things seem good
not yet working but closer
oh, another one, just for the fun of it
(throw (UnsupportedOperationException. (format "Unknown merge-type \"%s\"." merge-type)))))
^--- Unable to resolve classname: UnsupportedOperationException
it is just missing an import there 😄
probably in the JVM it happens automatically
also another one, sorry, will open issues for it - just using this as place holder
No matching field found: randomUUID for class java.util.UUID
might need to add this to reflection config, also in classes.clj - thanks, yeah, issues would be good
I think remove IFn
from spec-tools
did not work, I get the following:
"babashka.impl.reify2$reify_fn$reify__27572 cannot be cast to clojure.lang.IFn"
which seems to come from:
{:column 34
:file
"/home/cokap/.gitlibs/libs/org.babashka/spec.alpha/8df0712896f596680da7a32ae44bb000b7e45e68/src/main/clojure/clojure/spec/alpha.clj"
:line 950
:message
"babashka.impl.reify2$reify_fn$reify__27572 cannot be cast to clojure.lang.IFn"
Not 100% sure they are related thoughah yeah maybe it is trying that
I localized the failure, it is triggering it on
(s/assert* ::helpers.legacy-api.messages/tree-node-descriptor-changed message)
and the offending spec indeed looks like
(def tree-node-descriptor-changed
{:type (s/spec #{type-tree-node-descriptor-changed})
:ref (s/or :measurement-ref ::legacy-api.tree/measurement-tree-ref
:report-finding-ref ::legacy-api.tree/report-finding-tree-ref)
:field string?
;; Mirroring api's JsValue, which literally means any JSON value, including arrays and objects
:value (s/nilable (s/or :number number?
:string string?
:vector vector?
:object map?))})
so I guess that IFn
is kind of necessary?
I don't know why exactly, but if you can make a smaller repro using only clojure.spec, that could be helpful
I will do it, but I am not sure anymore this route is worth it...`spec-tools` is kind of falling into deprecation mode from what I have understood...so probably better to spend the time migrating to spec1 or malli
@U04V15CAJ apologies for writing here again, I have introduced merr
to the tests and it's got a MerrError
in it
Now I get
No reader function for tag merr.core.MerrError
Is there a way to tell the test runner to load reader tags that you know of?
right, that's the thing I am fixing now...probably we don't need this and use the constructor
the question probably still stands around records though, but maybe not worth spending too much time on it 😄
yes, I'm just wondering how you would end up in that situation since I don't see any mention of that in the README
oh thank you!
bb just doesn't scan the classpath for these data_readers files because of the startup penalty
man I totally missed that!