-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix NPE when pretty/report
called outside test
#36
base: master
Are you sure you want to change the base?
Conversation
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 |
report
can be run from code fixtures which causedpretty/testing-vars-str
to throw a NullPointerExceptionbecause testing-vars is nil inside fixtures.