Reputation: 3970
I’m trying to understand testing for packages in racket. And I wonder if anyone can give me an explainer on the idiomatic way to do package testing. So, I have a package in front of me (it’s someone else’s but I’m thinking about contributing) that has a few collections. The info.rkt looks a bit like this:
#lang info
(define collection 'multi)
(define deps '(("base" #:version "6.2.900.15") ;runtime dependencies ))
(define build-deps '(;build dependencies))
Now the package article at https://blog.racket-lang.org/2017/10/tutorial-creating-a-package.html is pretty clear on what happens in single collection situation. But less so in a multi collection situation.
Right now in order to test the package you need to install the package, run raco test
then clean up by removing the package. I think I should test the package without installing it. In which case how best to oganise the info.rkt
and requires
in the main.rkt
and friends to keep the path localised and therefore the test self-contained?
Upvotes: 2
Views: 135
Reputation: 10643
This is an interesting question, and you may want to ask it on the Racket mailing list or Slack.
My recommendation is to assume that in most cases you must install a package to test it, especially if it contains multiple collections. In particular, I recommend assuming that requiring a module in another collection should always use an absolute module path instead of a relative path, even if they're in the same package. I was surprised that this doesn't seem to be enforced (based on one small test I did), but I wouldn't rely on the current lax behavior. I doubt Scribble can handle relative module names (but I haven't checked), so if your definition of "testing" includes building and checking the docs, that's another reason installation would be needed.
Upvotes: 3