👋 hi all, I’ve only been using Kaocha a month or two, and I’m not doing anything fancy with it, but so far I’ve been quite pleased.
I seem to have run into some problem that I don’t understand and I wanted to check here if perhaps I’ve made some common mistake.
I’m using a very vanilla setup: defining my tests with clojure.test,
and this is the entirety of my tests.edn
:
#kaocha/v1
{:tests [{:id :examples
:test-paths ["test/examples"]}]}
What I’m seeing is that I have a failing test that seems to fail quite “normally” when I run the test var directly:
user=> (dad.db.export-test/split-record)
FAIL in (split-record) (export_test.clj:20)
expected: (= {:systems {"Discourse" {"links-main" "<https://discourse.org/>"}, :systems-containers {"web" {:system "Discourse", "summary" "web server", "technology" "Tomcat"}, "db" {:system "Discourse", "summary" "db server", "technology" "Access"}, "cache" {:system "Discourse", "summary" "hot keys", "technology" "PHP"}}}} ((var e/split-record) :systems (map-entry "Discourse" {"links-main" "<https://discourse.org/>", "containers" {"web" {"summary" "web server", "technology" "Tomcat"}, "db" {"summary" "db server", "technology" "Access"}, "cache" {"summary" "hot keys", "technology" "PHP"}}})))
but when I run it with Kaocha:
user=> (run 'dad.db.export-test/split-record)
actual: java.lang.IllegalArgumentException: Key must be integer
at clojure.lang.APersistentVector.assoc (APersistentVector.java:347)
clojure.lang.APersistentVector.assoc (APersistentVector.java:18)
clojure.lang.RT.assoc (RT.java:827)
clojure.core$assoc__5419.invokeStatic (core.clj:191)
clojure.core/assoc (core.clj:190)
dad.db.export$add_fk.invokeStatic (export.clj:30)
dad.db.export$add_fk.invoke (export.clj:27)
dad.db.export$split_record$fn__1454$fn__1455.invoke (export.clj:49)
clojure.core$map$fn__5870.invoke (core.clj:2757)
clojure.lang.LazySeq.sval (LazySeq.java:42)
clojure.lang.LazySeq.seq (LazySeq.java:51)
clojure.lang.RT.seq (RT.java:535)
clojure.core$seq__5405.invokeStatic (core.clj:137)
clojure.core$print_sequential.invokeStatic (core_print.clj:53)
clojure.core$fn__7315.invokeStatic (core_print.clj:174)
clojure.core/fn (core_print.clj:174)
clojure.lang.MultiFn.invoke (MultiFn.java:234)
clojure.core$pr_on.invokeStatic (core.clj:3676)
clojure.core$pr_on.invoke (core.clj:3670)
clojure.core$print_prefix_map$fn__7337.invoke (core_print.clj:233)
clojure.core$print_sequential.invokeStatic (core_print.clj:66)
clojure.core$print_prefix_map.invokeStatic (core_print.clj:229)
clojure.core$print_map.invokeStatic (core_print.clj:238)
clojure.core$fn__7364.invokeStatic (core_print.clj:266)
clojure.core/fn (core_print.clj:263)
clojure.lang.MultiFn.invoke (MultiFn.java:234)
clojure.core$pr_on.invokeStatic (core.clj:3676)
clojure.core$pr_on.invoke (core.clj:3670)
clojure.core$print_sequential.invokeStatic (core_print.clj:66)
clojure.core$fn__7315.invokeStatic (core_print.clj:174)
clojure.core/fn (core_print.clj:174)
clojure.lang.MultiFn.invoke (MultiFn.java:234)
clojure.core$pr_on.invokeStatic (core.clj:3676)
clojure.core$pr_on.invoke (core.clj:3670)
clojure.core$print_sequential.invokeStatic (core_print.clj:66)
clojure.core$fn__7315.invokeStatic (core_print.clj:174)
clojure.core/fn (core_print.clj:174)
clojure.lang.MultiFn.invoke (MultiFn.java:234)
clojure.core$pr_on.invokeStatic (core.clj:3676)
clojure.core$pr.invokeStatic (core.clj:3679)
clojure.core$pr.invoke (core.clj:3679)
clojure.lang.AFn.applyToHelper (AFn.java:154)
clojure.lang.RestFn.applyTo (RestFn.java:132)
clojure.core$apply.invokeStatic (core.clj:665)
clojure.core$pr_str.invokeStatic (core.clj:4738)
clojure.test$fn__9663.invokeStatic (test.clj:382)
clojure.test/fn (test.clj:375)
clojure.lang.MultiFn.invoke (MultiFn.java:229)
kaocha.monkey_patch$report.invokeStatic (monkey_patch.clj:27)
kaocha.monkey_patch$report.invoke (monkey_patch.clj:26)
kaocha.monkey_patch$do_report.invokeStatic (monkey_patch.clj:70)
kaocha.monkey_patch$do_report.invoke (monkey_patch.clj:35)
dad.db.export_test$fn__1489.invokeStatic (export_test.clj:20)
dad.db.export_test/fn (export_test.clj:19)
clojure.test$test_var$fn__9743.invoke (test.clj:717)
clojure.test$test_var.invokeStatic (test.clj:717)
clojure.test$test_var.invoke (test.clj:708)
dad.db.export_test$split_record.invokeStatic (export_test.clj:19)
dad.db.export_test$split_record.invoke (export_test.clj:19)
user$eval12043.invokeStatic (NO_SOURCE_FILE:1)
user$eval12043.invoke (NO_SOURCE_FILE:1)
clojure.lang.Compiler.eval (Compiler.java:7177)
clojure.lang.Compiler.eval (Compiler.java:7132)
clojure.core$eval.invokeStatic (core.clj:3216)
clojure.core$eval.invoke (core.clj:3212)
clojure.main$repl$read_eval_print__9092$fn__9095.invoke (main.clj:437)
clojure.main$repl$read_eval_print__9092.invoke (main.clj:437)
clojure.main$repl$fn__9101.invoke (main.clj:458)
clojure.main$repl.invokeStatic (main.clj:458)
clojure.main$repl_opt.invokeStatic (main.clj:522)
clojure.main$repl_opt.invoke (main.clj:518)
clojure.main$main.invokeStatic (main.clj:664)
clojure.main$main.doInvoke (main.clj:616)
clojure.lang.RestFn.applyTo (RestFn.java:137)
clojure.lang.Var.applyTo (Var.java:705)
clojure.main.main (main.java:40)
[(.F)]
FAIL in dad.db.export-test/split-record (export_test.clj:20)
ERROR: Error in reporter: class java.lang.IllegalArgumentException when processing :summary
Randomized with --seed 525634685java.lang.IllegalArgumentException: Key must be integer
at clojure.lang.APersistentVector.assoc (APersistentVector.java:347)
...
dad.db.export$add_fk.invokeStatic (export.clj:30)
dad.db.export$add_fk.invoke (export.clj:27)
dad.db.export$split_record$fn__1454$fn__1455.invoke (export.clj:49)
...
puget.printer.PrettyPrinter.visit_seq (printer.clj:529)
fipp.visit$visit_STAR_.invokeStatic (visit.cljc:44)
fipp.visit$visit_STAR_.invoke (visit.cljc:32)
puget.printer$format_doc_STAR_.invokeStatic (printer.clj:224)
puget.printer$format_doc_STAR_.invoke (printer.clj:217)
puget.printer$format_doc.invokeStatic (printer.clj:232)
puget.printer$format_doc.invoke (printer.clj:227)
lambdaisland.deep_diff.printer$fn__12025.invokeStatic (printer.clj:98)
lambdaisland.deep_diff.printer/fn (printer.clj:89)
puget.printer$format_doc_STAR_.invokeStatic (printer.clj:223)
puget.printer$format_doc_STAR_.invoke (printer.clj:217)
puget.printer$format_doc.invokeStatic (printer.clj:232)
puget.printer$format_doc.invoke (printer.clj:227)
...
fipp.engine$serialize.invokeStatic (engine.cljc:15)
fipp.engine$serialize.invoke (engine.cljc:12)
...
fipp.engine$serialize.invokeStatic (engine.cljc:15)
fipp.engine$serialize.invoke (engine.cljc:12)
fipp.engine$eval11206$fn__11208.invoke (engine.cljc:63)
...
fipp.engine$serialize.invokeStatic (engine.cljc:18)
fipp.engine$serialize.invoke (engine.cljc:12)
...
fipp.engine$serialize.invokeStatic (engine.cljc:15)
fipp.engine$serialize.invoke (engine.cljc:12)
fipp.engine$eval11187$fn__11189.invoke (engine.cljc:48)
...
fipp.engine$serialize.invokeStatic (engine.cljc:18)
fipp.engine$serialize.invoke (engine.cljc:12)
...
fipp.engine$serialize.invokeStatic (engine.cljc:15)
fipp.engine$serialize.invoke (engine.cljc:12)
fipp.engine$eval11195$fn__11197.invoke (engine.cljc:55)
...
fipp.engine$serialize.invokeStatic (engine.cljc:18)
fipp.engine$serialize.invoke (engine.cljc:12)
...
fipp.engine$serialize.invokeStatic (engine.cljc:15)
fipp.engine$serialize.invoke (engine.cljc:12)
fipp.engine$eval11165$fn__11167.invoke (engine.cljc:35)
...
fipp.engine$serialize.invokeStatic (engine.cljc:18)
fipp.engine$serialize.invoke (engine.cljc:12)
fipp.engine$pprint_document.invokeStatic (engine.cljc:239)
fipp.engine$pprint_document.invoke (engine.cljc:234)
...
kaocha.output$print_doc.invokeStatic (output.clj:41)
kaocha.output$print_doc.invoke (output.clj:37)
kaocha.output$print_doc.invokeStatic (output.clj:39)
kaocha.output$print_doc.invoke (output.clj:37)
kaocha.report$print_expression.invokeStatic (report.clj:249)
kaocha.report$print_expression.invoke (report.clj:240)
kaocha.report$eval3843$fn__3844.invoke (report.clj:269)
...
kaocha.report$eval3859$fn__3861.invoke (report.clj:286)
...
kaocha.report$eval3876$fn__3877$fn__3883.invoke (report.clj:311)
kaocha.report$eval3876$fn__3877.invoke (report.clj:309)
...
kaocha.config$resolve_reporter$fn__4068$fn__4069.invoke (config.clj:150)
...
kaocha.config$resolve_reporter$fn__4068.invoke (config.clj:150)
kaocha.config$resolve_reporter$fn__4068$fn__4069.invoke (config.clj:150)
...
kaocha.config$resolve_reporter$fn__4068.invoke (config.clj:150)
kaocha.api$resolve_reporter$fn__4160.invoke (api.clj:56)
...
kaocha.api$run$fn__4164$fn__4165$fn__4166.invoke (api.clj:112)
...
kaocha.api$run$fn__4164$fn__4165.invoke (api.clj:98)
...
kaocha.api$run$fn__4164.invoke (api.clj:97)
...
kaocha.api$run.invokeStatic (api.clj:83)
kaocha.api$run.invoke (api.clj:71)
kaocha.repl$run.invokeStatic (repl.clj:153)
kaocha.repl$run.doInvoke (repl.clj:124)
...
user$eval12045.invokeStatic (NO_SOURCE_FILE:1)
user$eval12045.invoke (NO_SOURCE_FILE:1)
...
#:kaocha.result{:count 1, :pass 1, :error 0, :fail 1, :pending 0}
I’m only asking about this because of the part ERROR: Error in reporter
— I’m sure it’s still PEBKAC tho.
Anyway, anyone have any suggestions of what I might be doing wrong here? Thanks!
Ah, and I’m using the latest release, 1.0.632, on Clojure 1.10.2-alpha1 on MacOS.
Ah, I guess I should post this to Clojureverse?
I just noticed that link at the top
…maybe it’s because of laziness in the data structure that my function returns?
I just noticed that the exception isn’t thrown until I try to realize the results (e.g. by printing them)