How do I forcefully import all functions/macros from my Package into my testing en

How do I forcefully import all functions/macros from my Package into my testing environment. I currently have this monstrosity at the top of my runtests.jl

import AutoActuary: add_namespace, add_t_index, has_symbol, is_t_dottable, t_to_dot, ispreprocessable, remove_linenumbernodes, 
                    get_variables, t_linearcombinations, replace_variables, replace_variables, get_t_offsets, cycleclusters, 
                    add_name!, add_edge!, set_name!, get_name, get_id, has_name, create_a_dependancy_graph

Note that the original poster on Slack cannot see your response here on Discourse. Consider transcribing the appropriate answer back to Slack, or pinging the poster here on Discourse so they can follow this thread.
(Original message :slack:) (More Info)

1 Like

Boston Gelwan 1 hour ago

Wouldn’t using AutoActuary do the trick?

Boston Gelwan 1 hour ago

Unless the issue is that they aren’t exported.

Heetbeet 1 hour ago

Yes, they aren’t exported, but I still want to test then without having to type AutoActuary.foo or import foo explicitely.

Boston Gelwan 1 hour ago

I actually don’t think explicit imports are very monstruous at all. I’d be less comfortable with importing all the non-exported members of a module with some hack than just writing things out.But perhaps you and I differ in a sense of style. (edited)

Heetbeet 1 hour ago

I like explicit import and also likes to hide most of my internal functions, but in the case of testing, I would like to have something as close to “living in the same namespace” as possible.

Mark Kittisopikul 1 hour ago

What happen if you implemented the tests within the module itself and then just ran them from runtests.jl ?

Tommy Hofmann 1 hour ago

for i in names(AutoActuary, all = true);try Main.eval(Meta.parse("import AutoActuary: " * string(i))); catch e; end; end

Fredrik Ekre 1 hour ago

import AutoActuary as aa and then aa.foo etc?

Heetbeet 43 minutes ago

@Mark Kittisopikul, like having them in a function and then call that function from runtests.jl? I haven’t thought about that, that might work. But I think it’s nice having all the tests at the testy location.

Heetbeet 32 minutes ago

I think I’m going to use this function, and then when I get closer to a “first release” remove it with the explicit names.

exportall() = begin
    for i in names(AutoActuary, all=true)
        if i in (:eval, :include)
            continue
        end
        try
            Main.eval(Meta.parse("import AutoActuary: $(i)"))
        catch e
        end
    end
end

Heetbeet < 1 minute ago

Hmmm, but you end up losing all the VSCode clickiness action.