Unit testing in Leiningen not finding test file

clojure, leiningen, testing

Solution

From your error, it appears your directory structure is different than what I have used. lein wants core.clj (for test) in the directory that I have posted below. Here is my test directory path that was set up by `lein new util`

~/projects/clojure/util/test/util/test$

Here's the project.clj file, just in case you need it for further clarity.

(defproject util "1.0.4-SNAPSHOT"
  :description "A general purposes Clojure library"
  :dependencies [[org.clojure/clojure "1.4.0"]
                 [clojure-csv/clojure-csv "1.3.2"]
                 [org.clojure/tools.cli "0.1.0"]]
  :aot [util.core]
  :omit-source true)

Problem

For a Lein project called myproject, I've created a file core.clj in the myproject/test/ directory. ``` (ns myproject.test.core (:use clojure.test)) ;;tests follow ``` When I try to run the test with "lein test", it fails with the error: ``` Exception in thread "main" java.io.FileNotFoundException: Could not locate myproject/test/core__init.class or myproject/test/core.clj on classpath: ```

Original source