4

我正在尝试为 midje 设置自动测试。目前,运行 lein midje 有效。然而,运行 lein midje :autottest 给了我下面的堆栈跟踪。

我遍历我的不同命名空间,它们都编译

Compiling 1 source files to /Users/oloo/Documents/work/cmp/target/classes

warning: Supported source version 'RELEASE_6' from annotation processor 'org.sonatype.guice.bean.scanners.index.SisuIndexAPT6' less than -source '1.7'
1 warning

======================================================================
Loading (cmp.models cmp.util cmp.repository.orderdeliveryschedule-repository cmp.repository.facility-repository cmp.repository.facility-cycle-data-repository cmp.views.layout cmp.routes.facility cmp.repository.item-repository cmp.repository.procurement-plan-repository cmp.routes.login cmp.excel-util cmp.repository.district-repository cmp.repository.facility-order-repository cmp.repository.facility-issue-repository cmp.routes.import-data cmp.test-util cmp.routes.item cmp.routes.district cmp.repository.user-repository cmp.routes.reports cmp.repository.category-repository cmp.routes.facility-issue cmp.routes.procurement-plan cmp.routes.facility-order cmp.handler cmp.repl cmp.repository.level-repository)
log4j:WARN No appenders could be found for logger (com.mchange.v2.log.MLog).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" java.lang.Exception: No namespace: cmp.routes.item found
    at clojure.core$the_ns.invoke(core.clj:3760) 
    at clojure.core$ns_name.invoke(core.clj:3767)  
    at midje.repl$on_require_failure.invoke(repl.clj:387)  
    at midje.data.project_state$require_namespaces_BANG_$broken_source_file_QMARK___5874.invoke(project_state.clj:65)  
    at midje.data.project_state$require_namespaces_BANG_$shorten_ns_list_by_trying_first__5877.invoke(project_state.clj:69)  
    at midje.data.project_state$require_namespaces_BANG_.invoke(project_state.clj:75)  
    at midje.data.project_state$react_to_tracker_BANG_$fn__5889.invoke(project_state.clj:98)  
    at midje.repl$namespace_stream_checker.invoke(repl.clj:403)  
    at midje.data.project_state$react_to_tracker_BANG_.invoke(project_state.clj:94)  
    at midje.data.project_state$mkfn_COLON_scan_and_react$fn__5893$fn__5894.invoke(project_state.clj:109)  
    at clojure.lang.Atom.swap(Atom.java:37)  
    at clojure.core$swap_BANG_.invoke(core.clj:2160)  
    at midje.data.project_state$mkfn_COLON_scan_and_react$fn__5893.invoke(project_state.clj:107)  
    at midje.data.project_state$load_everything.invoke(project_state.clj:117)  
    at midje.repl$autotest.doInvoke(repl.clj:511)  
    at clojure.lang.RestFn.invoke(RestFn.java:397)  
    at midje.repl$autotest.doInvoke(repl.clj:524)  
    at clojure.lang.RestFn.invoke(RestFn.java:408)  
    at user$eval6032.invoke(NO_SOURCE_FILE:1)
    at clojure.lang.Compiler.eval(Compiler.java:6619)  
    at clojure.lang.Compiler.eval(Compiler.java:6609)  
    at clojure.lang.Compiler.eval(Compiler.java:6582)  
    at clojure.core$eval.invoke(core.clj:2852)  
    at clojure.main$eval_opt.invoke(main.clj:308)  
    at clojure.main$initialize.invoke(main.clj:327)  
    at clojure.main$null_opt.invoke(main.clj:362)  
    at clojure.main$main.doInvoke(main.clj:440)  
    at clojure.lang.RestFn.invoke(RestFn.java:421)  
    at clojure.lang.Var.invoke(Var.java:419)  
    at clojure.lang.AFn.applyToHelper(AFn.java:163)  
    at clojure.lang.Var.applyTo(Var.java:532)  
    at clojure.main.main(main.java:37)  
Subprocess failed
4

2 回答 2

3

看到这个:https ://github.com/marick/Midje/issues/215

它说:

If a file being loaded by Midje at startup has a parse error (a reference to an unknown 
symbol, etc.) that prevents it from being loaded successfully, Midje swallows the original
load error and instead prints the following error, which is much less useful.

我也遇到过这种情况:任何小错字都会引发这种误导性的错误信息。

于 2013-10-31T10:03:41.887 回答
2

我记得使用该表单的自动测试和命名空间:require:use其他命名空间存在问题。[prefix ns1 ns2 ...]因此,以下方法不起作用:

(ns abc
  (:use [abc def ghi]))

虽然这没关系:

(ns abc
  (:use abc.def
        abc.ghi))

你在使用那种语法吗?

于 2013-10-28T22:04:48.233 回答