set variables before executing the "test-op"

Faré fahree at gmail.com
Tue Sep 6 12:03:20 UTC 2016


It's probably wrong to set those settings from your .asd file, since they
may be set or reset before your project runs, or in between two runs.

If you actually care about those variables, define a function that sets
them,
and call it at the beginning of those files.

If you have a lot of files, define a class for those files that does it in
its perform method for basic-load-op.

As for defining accessors before the packages are interned,
to be executed by a function run *after* they are interned,
you can use such idioms as:
   (setf (symbol-value (find-symbol* :*enable-colors* :prove.color) nil)
Note that find-symbol* is defined by uiop, which is :use'd by :asdf-user.

Alternatively, you could (load-system :prove) in your .asd file,
but it's ugly.

—♯ƒ • François-René ÐVB Rideau •Reflection&Cybernethics•
http://fare.tunes.org



On Tue, Sep 6, 2016 at 6:58 AM, Alexey Veretennikov <txm.fourier at gmail.com>
wrote:

> Hi all,
>
> I am using cl-project to generate project skeleton for the library
> including separate asd file for unit tests.
> The test framework I use is the default for cl-project: prove.
> Using this framework I would like to set some special variables to control
> test execution _before_ running the asdf:test-system
> i.e.
> (setf prove.color:*enable-colors* nil)
> (setf prove:*default-reporter* :tap)
>
> But the problem is when I set them directly in .asd file, the CL reader
> complains what the prove.color and prove packages do not exist (which is
> true, since the prove dependency is not yet loaded).
> I could set them in every test file, but I would like to set them globally.
> How could I set them after the dependency to unit test library (prove) is
> loaded and therefore package exists?
>
> This is what I have in .asd file for tests:
>
> :defsystem-depends-on (:prove-asdf)
> :perform (test-op :after (op c)
> (funcall (intern #.(string :run-test-system) :prove-asdf) c)
> (asdf:clear-system c)))
>
> Br
> /Alexey
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/asdf-devel/attachments/20160906/1cb72d40/attachment.html>


More information about the asdf-devel mailing list