Skip to content
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

Testrunner fails to find clojure.core/pcalls in unit test even though it works locally #38

Open
mbjarland opened this issue May 19, 2022 · 5 comments

Comments

@mbjarland
Copy link

I have a solution to bank-account:

(ns bank-account)

(defn open-account []
  (atom 0))

(defn close-account [account]
  (reset! account nil))

(defn get-balance [account]
  @account)

(defn update-balance [account amount]
  (swap! account + amount))

which works fine when doing lein test locally but fails with:

----- Error --------------------------------------------------------------------
Type:     clojure.lang.ExceptionInfo
Message:  Could not resolve symbol: pcalls
Phase:    analysis

when submitting the solution to the site. I had a different and more verbose solution earlier and it seems to have passed.

pcalls is used in one of the unit tests which from what I understand are not user-changeable. Also pcalls is part of clojure.core which should be automatically require:d unless explicitly excluded in clojure.

Not sure what is going on here.

@mbjarland
Copy link
Author

mbjarland commented May 19, 2022

Ah I can see that this issue has been discussed in issue #24 and should apparently be fixed by exercism/clojure PR 426.

However it seems that I'm still seeing this so something is still off.

@bobbicodes
Copy link
Member

I pasted your solution into the site and it passes for me, so I'm unsure how to reproduce the error. Is it still failing for you?

@mbjarland
Copy link
Author

Yes still failing:

image

@bobbicodes
Copy link
Member

bobbicodes commented May 20, 2022

I am guessing that the local copy of test/bank_account_test.clj is missing the definition for pcalls (i.e. your project directory that is being submitted via the CLI), due to it being an old version.

If that's the case, you could add it:

(defn pcalls
  "Executes the no-arg fns in parallel, returning a lazy sequence of
  their values"
  {:added "1.0"
   :static true}
  [& fns] (pmap #(%) fns))

Alternatively, you could update the exercise (using the link on the main web page for the bank account exercise) and re-download it to get the latest version.

@ErikSchierboom
Copy link
Member

ErikSchierboom commented May 24, 2022

@mbjarland You can indeed update by clicking on the update message and confirming the update on the exercise page at https://exercism.org/tracks/clojure/exercises/bank-account:

image

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

No branches or pull requests

3 participants