Skip to content

Conversation

gar3thjon3s
Copy link

Hi Phil,

Got a chance to look at this this morning. Got it all working AFAICT. I removed the swank support like you suggested. One weird thing is that there seems to be some kind of chicken and egg situation with namespaces that means I am using nrepl-load-current-buffer effectively twice on each run of the tests. If I don't do this, you have to manually compile/load the test file before you can run the tests.

Please give it a shot and see if you notice anything I missed.

Thanks,
Gaz

@technomancy
Copy link
Contributor

Looks like we got a stray char on line 409, and we're still requiring nrepl with the NOERROR arg, but apart from that it looks good. If you can fix those I'll get it merged in and we can get some more eyes on it before cutting a release.

Thanks a bunch!

@gar3thjon3s
Copy link
Author

Argh, not sure how that 'n' got in there. Thanks for checking :)

@coopernurse
Copy link

Hi guys. I just tried these changes locally on one of my projects and it seems to work well. Just FYI. Cheers.

technomancy added a commit that referenced this pull request Oct 27, 2012
@technomancy technomancy merged commit 8591e4a into clojure-emacs:master Oct 27, 2012
@technomancy
Copy link
Contributor

Sweeeeet

@dakrone
Copy link

dakrone commented Oct 28, 2012

So this works great if you open a test file, run nrepl-jack-in, compile the test file, then use C-c C-, to run the tests.

However, if you open a non-test file, run nrepl-jack-in, compile the file with C-c C-k, then open a test file (in the same project) and attempt to compile and run the tests, you get this exception:

clojure.lang.Compiler$CompilerException: java.lang.ClassNotFoundException: clojure.test.mode, compiling:(NO_SOURCE_PATH:1)
 at clojure.lang.Compiler.analyze (Compiler.java:6281)
    clojure.lang.Compiler.analyze (Compiler.java:6223)
    clojure.lang.Compiler$InvokeExpr.parse (Compiler.java:3548)
    clojure.lang.Compiler.analyzeSeq (Compiler.java:6457)
    clojure.lang.Compiler.analyze (Compiler.java:6262)
    clojure.lang.Compiler.analyze (Compiler.java:6223)
    clojure.lang.Compiler$InvokeExpr.parse (Compiler.java:3548)
    clojure.lang.Compiler.analyzeSeq (Compiler.java:6457)
    clojure.lang.Compiler.analyze (Compiler.java:6262)
    clojure.lang.Compiler.analyze (Compiler.java:6223)
    clojure.lang.Compiler$BodyExpr$Parser.parse (Compiler.java:5618)
    clojure.lang.Compiler$LetExpr$Parser.parse (Compiler.java:5919)
    clojure.lang.Compiler.analyzeSeq (Compiler.java:6455)
    clojure.lang.Compiler.analyze (Compiler.java:6262)
    clojure.lang.Compiler.analyze (Compiler.java:6223)
    clojure.lang.Compiler$BodyExpr$Parser.parse (Compiler.java:5618)
    clojure.lang.Compiler$FnMethod.parse (Compiler.java:5054)
    clojure.lang.Compiler$FnExpr.parse (Compiler.java:3674)
    clojure.lang.Compiler.analyzeSeq (Compiler.java:6453)
    clojure.lang.Compiler.analyze (Compiler.java:6262)
    clojure.lang.Compiler.eval (Compiler.java:6508)
    clojure.lang.Compiler.eval (Compiler.java:6477)
    clojure.core$eval.invoke (core.clj:2797)
    clojure.main$repl$read_eval_print__6405.invoke (main.clj:245)
    clojure.main$repl$fn__6410.invoke (main.clj:266)
    clojure.main$repl.doInvoke (main.clj:266)
    clojure.lang.RestFn.invoke (RestFn.java:1096)
    clojure.tools.nrepl.middleware.interruptible_eval$evaluate$fn__495.invoke (interruptible_eval.clj:57)
    clojure.lang.AFn.applyToHelper (AFn.java:159)
    clojure.lang.AFn.applyTo (AFn.java:151)
    clojure.core$apply.invoke (core.clj:601)
    clojure.core$with_bindings_STAR_.doInvoke (core.clj:1771)
    clojure.lang.RestFn.invoke (RestFn.java:425)
    clojure.tools.nrepl.middleware.interruptible_eval$evaluate.invoke (interruptible_eval.clj:42)
    clojure.tools.nrepl.middleware.interruptible_eval$interruptible_eval$fn__536$fn__538.invoke (interruptible_eval.clj:170)
    clojure.core$comp$fn__4034.invoke (core.clj:2278)
    clojure.tools.nrepl.middleware.interruptible_eval$run_next$fn__529.invoke (interruptible_eval.clj:137)
    clojure.lang.AFn.run (AFn.java:24)
    java.util.concurrent.ThreadPoolExecutor$Worker.runTask (ThreadPoolExecutor.java:886)
    java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:908)
    java.lang.Thread.run (Thread.java:680)

@gar3thjon3s
Copy link
Author

Yes you're right. Looks like an issue with the clojure-test-load-reporting function not working when it gets run as you switch to that buffer and clojure-test-mode gets enabled. I actually get a "Namespace not found" message before this also, not sure which namespace it is referring to :| Will take a look.

@gar3thjon3s
Copy link
Author

I decided to clean up my setup completely as I was getting inconsistent results, and now I cannot reproduce this problem at all. I basically removed clojure-mode and nrepl from my packages and instead downloaded clojure-mode.el/clojure-test-mode.el (master), and nrepl.el (lastest release version), put them on my load path and required them in init.el. Now it works in all scenarios. I can nrepl-jack-in, go to a src file, compile, switch to test and run and it all works. I can also go to the test first and just C-c , and it runs the tests fine too.

Can I ask @dakrone, how were you testing out the changes?

@dakrone
Copy link

dakrone commented Oct 28, 2012

@gar3thjon3s I am using the latest nrepl.el (directly from git, latest master commit - 923234c4) and latest clojure-mode and clojure-test-mode.el from MELPA (http://melpa.milkbox.net/packages/clojure-test-mode-20121025.1300.el)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants