Skip to content

Commit 31d7dc7

Browse files
committed
README: add hints on how to use Revise
1 parent b390e22 commit 31d7dc7

File tree

1 file changed

+25
-5
lines changed

1 file changed

+25
-5
lines changed

README.md

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ dependency). But `ReTest` still has to be loaded (as a "test" dependency) in
3737
order to call `retest`.
3838

3939
Finally, for convenience, `@testset` also implicitly defines a `runtests` function
40-
within the enclosing module, say `M`, such `M.runtests(...)` is equivalent to
40+
within the enclosing module, say `M`, such that `M.runtests(...)` is equivalent to
4141
calling `retest(M, ...)`.
4242

4343
### `retest` docstring
@@ -150,7 +150,27 @@ it can be filtered out.
150150
When `Revise` is loaded and a testset is updated, `ReTest` will observe that a
151151
new testset is added with the same description as a previously existing one,
152152
which is then overwritten. This works only if the description is not modified,
153-
otherwise both the old and new versions of the testset will co-exist. For
154-
testsets in a "script" loaded with `includet`, e.g. those in a "test/tests.jl"
155-
file, you can request `Revise` to "load" the updated testsets by putting
156-
`__revise_mode__ = :eval` in the enclosing module.
153+
otherwise both the old and new versions of the testset will co-exist.
154+
155+
For testsets in a "script" loaded with `includet`, e.g. those in a
156+
"test/tests.jl" file, you can request `Revise` to "load" the updated testsets by
157+
putting `__revise_mode__ = :eval` in the enclosing module.
158+
159+
When files are included recursively, plain `includet` won't work
160+
(it is currently documented to be "deliberately non-recursive").
161+
There are two work-arounds:
162+
1. rename your "test/tests.jl" file to "test/MyPackageTests.jl" and load it as a module
163+
(this might involve updating your `LOAD_PATH` to include "test/" and making sure
164+
the required packages are found)
165+
2. use the [following `recursive_includet`](https://github.com/timholy/Revise.jl/issues/518#issuecomment-667097500)
166+
function instead of `includet`:
167+
```julia
168+
function recursive_includet(filename)
169+
already_included = copy(Revise.included_files)
170+
includet(filename)
171+
newly_included = setdiff(Revise.included_files, already_included)
172+
for (mod, file) in newly_included
173+
Revise.track(mod, file)
174+
end
175+
end
176+
```

0 commit comments

Comments
 (0)