practicalli

https://practicalli.github.io/ http://yt.vu/+practicalli (youtube)
Eugen 2020-12-17T11:56:52.264200Z

hi, I created a new project with clojure-deps-edn and I can't seem to run the tests https://gitlab.com/ieugen/hledger-grammars/-/tree/fail-to-test When I clojure -M:test/cognitect I get

{:clojure.main/message
 "Execution error (FileNotFoundException) at cognitect.test-runner/test (test_runner.clj:62).\nCould not locate ieugen/hledger/timeclock_test__init.class, ieugen/hledger/timeclock_test.clj or ieugen/hledger/timeclock_test.cljc on classpath. Please check that namespaces with dashes use underscores in the Clojure file name.\n",
 :clojure.main/triage
 {:clojure.error/class java.io.FileNotFoundException,
  :clojure.error/line 62,
  :clojure.error/cause
  "Could not locate ieugen/hledger/timeclock_test__init.class, ieugen/hledger/timeclock_test.clj or ieugen/hledger/timeclock_test.cljc on classpath. Please check that namespaces with dashes use underscores in the Clojure file name.",
  :clojure.error/symbol cognitect.test-runner/test,
  :clojure.error/source "test_runner.clj",
  :clojure.error/phase :execution},
 :clojure.main/trace
 {:via
  [{:type java.io.FileNotFoundException,
    :message
    "Could not locate ieugen/hledger/timeclock_test__init.class, ieugen/hledger/timeclock_test.clj or ieugen/hledger/timeclock_test.cljc on classpath. Please check that namespaces with dashes use underscores in the Clojure file name.",
    :at [clojure.lang.RT load "RT.java" 462]}],
  :trace
  [[clojure.lang.RT load "RT.java" 462]
   [clojure.lang.RT load "RT.java" 424]
   [clojure.core$load$fn__6839 invoke "core.clj" 6126]
   [clojure.core$load invokeStatic "core.clj" 6125]
   [clojure.core$load doInvoke "core.clj" 6109]
   [clojure.lang.RestFn invoke "RestFn.java" 408]
   [clojure.core$load_one invokeStatic "core.clj" 5908]
   [clojure.core$load_one invoke "core.clj" 5903]
   [clojure.core$load_lib$fn__6780 invoke "core.clj" 5948]
   [clojure.core$load_lib invokeStatic "core.clj" 5947]
   [clojure.core$load_lib doInvoke "core.clj" 5928]
   [clojure.lang.RestFn applyTo "RestFn.java" 142]
   [clojure.core$apply invokeStatic "core.clj" 667]
   [clojure.core$load_libs invokeStatic "core.clj" 5985]
   [clojure.core$load_libs doInvoke "core.clj" 5969]
   [clojure.lang.RestFn applyTo "RestFn.java" 137]
   [clojure.core$apply invokeStatic "core.clj" 667]
   [clojure.core$require invokeStatic "core.clj" 6007]
   [clojure.core$require doInvoke "core.clj" 6007]
   [clojure.lang.RestFn invoke "RestFn.java" 408]
   [clojure.core$map$fn__5866 invoke "core.clj" 2755]
   [clojure.lang.LazySeq sval "LazySeq.java" 42]
   [clojure.lang.LazySeq seq "LazySeq.java" 51]
   [clojure.lang.RT seq "RT.java" 535]
   [clojure.core$seq__5402 invokeStatic "core.clj" 137]
   [clojure.core$dorun invokeStatic "core.clj" 3133]
   [clojure.core$dorun invoke "core.clj" 3133]
   [cognitect.test_runner$test invokeStatic "test_runner.clj" 62]
   [cognitect.test_runner$test invoke "test_runner.clj" 53]
   [cognitect.test_runner$_main invokeStatic "test_runner.clj" 116]
   [cognitect.test_runner$_main doInvoke "test_runner.clj" 105]
   [clojure.lang.RestFn invoke "RestFn.java" 397]
   [clojure.lang.AFn applyToHelper "AFn.java" 152]
   [clojure.lang.RestFn applyTo "RestFn.java" 132]
   [clojure.lang.Var applyTo "Var.java" 705]
   [clojure.core$apply invokeStatic "core.clj" 665]
   [clojure.main$main_opt invokeStatic "main.clj" 514]
   [clojure.main$main_opt invoke "main.clj" 510]
   [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]],
  :cause
  "Could not locate ieugen/hledger/timeclock_test__init.class, ieugen/hledger/timeclock_test.clj or ieugen/hledger/timeclock_test.cljc on classpath. Please check that namespaces with dashes use underscores in the Clojure file name."}}
{:version "1.10.1.754"
 :config-files ["/usr/local/lib/clojure/deps.edn" "/home/ieugen/.clojure/deps.edn" "deps.edn" ]
 :config-user "/home/ieugen/.clojure/deps.edn"
 :config-project "deps.edn"
 :install-dir "/usr/local/lib/clojure"
 :config-dir "/home/ieugen/.clojure"
 :cache-dir ".cpcache"
 :force false
 :repro false
 :main-aliases ""
 :repl-aliases ""}

practicalli-john 2020-12-17T12:15:17.264900Z

Change the file name timelock-test.clj to timelock_test.clj The JVM classpath doest like - in file names. Keep the namespace with a dash though.

Eugen 2020-12-17T12:17:09.265200Z

thanks, I knew the rule but somehow my eyse did not want to see the mistake

practicalli-john 2020-12-17T12:17:38.265400Z

Yes, its happened to me many times too... its an easy thing to do 🙂

Eugen 2020-12-17T12:20:32.265600Z

btw, I love the tool / configuration 🙂

practicalli-john 2020-12-17T12:24:09.265800Z

Thank you.

practicalli-john 2020-12-17T12:29:18.266Z

Unfortunately clj-kondo doesnt detect filename issues yet, although hopefully some day https://github.com/borkdude/clj-kondo/issues/842

1❤️
Eugen 2020-12-17T12:30:47.266600Z

things have improved since I started learning Clojure and will continue to improve

Eugen 2020-12-17T15:03:05.268100Z

How do I run the deps edn commands in docker for my gitlab builds? Is there a docker image with clojure-deps-edn ? This is a build and it does not run the tests because clojure-deps-end are not there https://gitlab.com/ieugen/hledger-grammars/-/jobs/918955583

practicalli-john 2020-12-17T15:41:22.269600Z

There is an image for CirceCI already has the Clojure CLI tools here - with links to find different versions. They seem to be updated fairly soon after a new release of the Clojure CLI.. I havent tried GitLabs yet. http://practicalli.github.io/clojure/continuous-integration/circle-ci/

practicalli-john 2020-12-17T15:43:38.270700Z

@eugen.stan Ah, it was specifically about practicalli clojure-deps-edn aliases You need to use an alias that is part of the project deps.edn configuration, so if creating with clj-new, then it would be clojure -M:test:runner or copy the alias from practicalli/clojure-deps-edn to the project deps.edn file.

practicalli-john 2020-12-17T15:45:00.272Z

Not sure how I would include the practicalli/clojure-deps-edn config in the image yet, but that could be useful. I will think about that... and find out who creates the docker images

Eugen 2020-12-17T16:07:51.273300Z

well, for starters I'll try to add a step to git clone <https://github.com/practicalli/clojure-deps-edn.git> $HOME/.clojure/

Eugen 2020-12-17T18:26:58.277100Z

the above failed, there seems to be .clojure . I had to delete .clojure and then clone it. The easiest way out is to have a docker image for clojure-deps-edn w/ automated builds set in place. I think that starting from the official clojure image would be great Let me know if/what you decide and maybe I can help. https://gitlab.com/ieugen/hledger-grammars/-/blob/master/.gitlab-ci.yml

Eugen 2020-12-17T21:23:22.280600Z

@jr0cket: I think the general issue with clojure-deps-edn is this: • If I install it in my home and use it in my projects, the build will kind of depend on my home configuration. • sending the code to someone else (or the CI) will require them to know about downloading and installing clojure-deps-edn. • To me this is an issue that needs to be solved somehow • an option would be to maybe add a project specific PROJECT_ROOT/.clojure/deps.edn ?!

Eamonn Sullivan 2020-12-17T21:46:57.282800Z

Was interested in this: 404 ERROR ! PAGE NOT FOUND

Eamonn Sullivan 2020-12-17T21:48:16.283200Z

I guess it just graduated from the test blog. I'll look in the regular blog.

practicalli-john 2020-12-17T22:01:20.290100Z

@eugen.stan The approach I currently take is that a build configuration should be self-contained. Any aliases required for the CI should be in the projects deps.edn configuration. The project deps.edn configuration should contain only test alias used for the project, so assume it should only contain just the one test runner. When using a continuous integration service, its only one additional alias for the test runner. So I am not sure of the advantage of using a user-level configuration for this type of environment. practicalli/clojure-deps-edn contains a wide range of aliases, some of which do the same task but in different ways. That configuration can be "installed" into an environment or specific aliases can be copied into the project deps.edn file (or used as examples)

practicalli-john 2020-12-17T22:03:25.292Z

I have used practicalli/clojure-deps-edn configuration to set up remote environments, specifically for collaborating live on code. The aliases were convienient in that case as its very much a development environment, so useful to have at hand the community tools that the extensive configuration defines.

practicalli-john 2020-12-17T22:09:07.293500Z

If we can add aliases to the default configuration for a CI environment, that does open some other options, so will look into this over the next few weeks. Thanks for the feedback.

Eugen 2020-12-17T22:14:07.294500Z

thanks for the explanation and glad to be of help, please ping me when you have something, I can help test

practicalli-john 2020-12-17T22:48:15.294600Z

Its back. https://practicalli.github.io/test-blog/posts/clojure-repl-jack-in-or-connect/ I am sharing a test and staging environment on the same github pages (I should fix this) I've been working at some other content for the last couple of days, but should get back to this on Friday.

1