Extracting contrib libraries from Lazytest

34 views
Skip to first unread message

Stuart Sierra

unread,
Nov 29, 2011, 8:27:01 PM11/29/11
to Clojure Dev
A year or so ago, I did a lot of work on a testing library called
Lazytest[1]. I received several requests to release parts of it as
independent libraries. What follows are suggestions for new contrib
libraries. Let me know what looks worthwhile. All code is 100% my work
and I am willing to donate it to clojure-contrib, but I might need
some help porting/maintaining the new libraries. -S

[1]: https://github.com/stuartsierra/lazytest

* lazytest.dependency => clojure.data.dependency

A small set of function to create and manipulate a graph of dependency
relationships. Similar to Clojure's hierarchies, but with more relaxed
rules. For example, hierarchies do not permit relationships like this:

A
C is child of A / \
B is child of A | B
C is child of B | /
C

But dependency graphs do permit such a structure:

C depends on A
B depends on A
C depends on B


* lazytest.nsdeps => add to clojure.tools.namespace

Requires dependency

Given a literal `ns` form, parses the :use and :require clauses to
return a set of namespaces that it depends on.


* lazytest.tracker => clojure.tools.tracker

Requires dependency, nsdeps, and tools.namespace

Given a directory, creates a function which can be called to poll the
filesystem for namespaces which have changed.


* Others

These are harder to make into general-purpose libraries, but
frequently requested.

** lazytest.reload => clojure.tools.reload

Removes a namespace and reloads it. Works around CLJ-371 (dynamic
defrecord definitions trumped by AOT versions in classpath) by
updating source file timestamps. Reaches into core to manipulate the
private #'clojure.core/*loaded-libs*.

** lazytest.watch => clojure.tools.watch

Requires reload and tracker

Polls a directory of source files, reloading them when they change.

Micah Martin

unread,
Nov 29, 2011, 9:58:59 PM11/29/11
to cloju...@googlegroups.com
A similar library exists:


It was extracted back in May from the testing framework Speclj (http://speclj.com/).

lazytests's auto-runner was brilliant… it was the inspiration for Speclj's auto-runner and, by extension, the Fresh library.

Micah

--
You received this message because you are subscribed to the Google Groups "Clojure Dev" group.
To post to this group, send email to cloju...@googlegroups.com.
To unsubscribe from this group, send email to clojure-dev...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/clojure-dev?hl=en.


James Reeves

unread,
Nov 29, 2011, 10:42:51 PM11/29/11
to cloju...@googlegroups.com
On 30 November 2011 01:27, Stuart Sierra <the.stua...@gmail.com> wrote:
> A year or so ago, I did a lot of work on a testing library called
> Lazytest[1]. I received several requests to release parts of it as
> independent libraries. What follows are suggestions for new contrib
> libraries. Let me know what looks worthwhile. All code is 100% my work
> and I am willing to donate it to clojure-contrib, but I might need
> some help porting/maintaining the new libraries.  -S

Incidentally, I pulled out the dependency and tracking parts of
Lazytest into a library called ns-tracker a couple of months ago:

https://github.com/weavejester/ns-tracker

It does combine the tracking and dependency parts together, but if you
want to use any of the small tweaks or the unit tests for it, feel
free to take them.

- James

Fogus

unread,
Dec 9, 2011, 10:35:54 AM12/9/11
to Clojure Dev
> A small set of function to create and manipulate a graph of

Does this calculate a graph from namespaces?

Stuart Sierra

unread,
Dec 9, 2011, 1:54:59 PM12/9/11
to cloju...@googlegroups.com
> Does this calculate a graph from namespaces?

yes. Given a namespace, you can query for all its dependencies, transitively.

Michael Fogus

unread,
Dec 9, 2011, 2:06:49 PM12/9/11
to cloju...@googlegroups.com
> yes. Given a namespace, you can query for all its dependencies,
> transitively.

I can use this yesterday. :-) My vote goes for this as a contrib.

:F

Reply all
Reply to author
Forward
0 new messages