Skip to content

Commit 04eea4e

Browse files
committed
distributed execution: add a note about potential subtle error
1 parent 24e9f28 commit 04eea4e

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

docs/src/index.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,20 @@ addprocs(2)
150150
MyPackageTests.runtests()
151151
```
152152

153+
!!! note
154+
155+
As was already mentioned, testset-for iterators are evaluated at load time in
156+
the enclosing module, but this currently happens only in the main process.
157+
This can lead to unexpected errors when the package was written without a
158+
`Distributed` use-case in mind.
159+
160+
For example, say the package defines a constant singleton object `X` which is
161+
normally equal to itself (because `X === X`). But if `X` is assigned to a
162+
testset-for loop variable `x`, it will be the one from the main process, so
163+
within the testset-for, a test like `x == X` might fail because `X` refers to
164+
the singleton object defined in another process; a solution in this case could
165+
be to define explicitly `==` for objects of the type of `X`.
166+
153167
It should be relatively easy to support threaded execution of testsets (it was
154168
actually implemented at one point). But it often happens that compiling
155169
package code and testset code (which currently is not threaded) takes quite

0 commit comments

Comments
 (0)