Fix NPE when pretty/report called outside test#36
Fix NPE when pretty/report called outside test#36ryfow wants to merge 1 commit intoweavejester:masterfrom
pretty/report called outside test#36Conversation
|
Can you provide an example of what you mean? |
|
In a project I maintain, I do some cleanup work in a fixture. If there's a problem, I call report with a specific file/line based on my stack because the file/line of the cleanup job isn't really that interesting. I can't give you my project, but here's an example of the sort of think I'm doing: (ns eftest.fixture-fail
(:require [clojure.test :refer :all]))
(defn failing-fixture [f]
(f)
(clojure.test/report {:type :fail :message "This fixture noticed a problem"
:file "file_name.clj"
:line 10}))
(use-fixtures :each failing-fixture)
(deftest foo
(is (= 1 1)))If I run this with If I run it with |
|
Should
|
`report` can be run from code fixtures which caused `pretty/testing-vars-str` to throw a NullPointerException because *testing-vars* is nil inside fixtures.
a28f8bd to
467fbab
Compare
|
I guess you could argue that. In my case, I have a function in my test code that checks status codes and calls I could wrap my I updated the test to set |
reportcan be run from code fixtures which causedpretty/testing-vars-strto throw a NullPointerExceptionbecause testing-vars is nil inside fixtures.