How to avoid name conflicts in MyPackage/runtests.jl

When testing my package I get errors that are not present when I run the failing test script in a new REPL, suggesting that namespace corruption is the problem. My runtests.jl setup is probably to blame; it looks like

files= ["test1.jl", "test2.jl"] 

for file in files: 

How should I better structure runtests.jl to avoid this issue?

I am not sure about this, unless you use file and files in some scope that is interfering.

In any case, there is

1 Like

I usually wrap everything inside individual files in a module. Usually it have a name of a file plus word Test. You can factor out common pieces and include them into individual files. So, it looks like that

module TestTest1

#actual tests

end #module

It’s more or less the same as SafeTestsets.jl just more explicit.

1 Like

That’ll do. Thanks!