|
1 |
| -using Distributed |
2 |
| -addprocs() |
3 |
| - |
4 |
| - |
5 |
| -using MLJBase |
6 |
| -if !MLJBase.TESTING |
7 |
| - error( |
8 |
| - "To test MLJBase, the environment variable "* |
9 |
| - "`TEST_MLJBASE` must be set to `\"true\"`\n"* |
10 |
| - "You can do this in the REPL with `ENV[\"TEST_MLJBASE\"]=\"true\"`" |
11 |
| - ) |
12 |
| -end |
13 |
| - |
14 |
| -@info "nprocs() = $(nprocs())" |
15 |
| -@static if VERSION >= v"1.3.0-DEV.573" |
16 |
| - import .Threads |
17 |
| - @info "nthreads() = $(Threads.nthreads())" |
18 |
| -else |
19 |
| - @info "Running julia $(VERSION). Multithreading tests excluded. " |
20 |
| -end |
21 |
| - |
22 |
| -@everywhere begin |
23 |
| - using MLJModelInterface |
24 |
| - using MLJBase |
25 |
| - using Test |
26 |
| - using CategoricalArrays |
27 |
| - using Logging |
28 |
| - using ComputationalResources |
29 |
| - using StableRNGs |
30 |
| -end |
31 |
| - |
32 |
| -import TypedTables |
33 |
| -using Tables |
34 |
| - |
35 |
| -function include_everywhere(filepath) |
36 |
| - include(filepath) # Load on Node 1 first, triggering any precompile |
37 |
| - if nprocs() > 1 |
38 |
| - fullpath = joinpath(@__DIR__, filepath) |
39 |
| - @sync for p in workers() |
40 |
| - @async remotecall_wait(include, p, fullpath) |
41 |
| - end |
42 |
| - end |
43 |
| -end |
44 |
| - |
45 |
| -include("test_utilities.jl") |
46 |
| - |
47 |
| -# load Models module containing model implementations for testing: |
48 |
| -print("Loading some models for testing...") |
49 |
| -include_everywhere("_models/models.jl") |
50 |
| -print("\r \r") |
51 |
| - |
52 |
| -# enable conditional testing of modules by providing test_args |
53 |
| -# e.g. `Pkg.test("MLJBase", test_args=["misc"])` |
54 |
| -RUN_ALL_TESTS = isempty(ARGS) |
55 |
| -macro conditional_testset(name, expr) |
56 |
| - name = string(name) |
57 |
| - esc(quote |
58 |
| - if RUN_ALL_TESTS || $name in ARGS |
59 |
| - @testset $name $expr |
60 |
| - end |
61 |
| - end) |
62 |
| -end |
| 1 | +# To speed up the development workflow, use `TestEnv`. |
| 2 | +# For example: |
| 3 | +# ``` |
| 4 | +# $ julia --project |
| 5 | +# |
| 6 | +# julia> ENV["TEST_MLJBASE"] = "true" |
| 7 | +# |
| 8 | +# julia> using TestEnv; TestEnv.activate() |
| 9 | +# |
| 10 | +# julia> include("test/preliminaries.jl") |
| 11 | +# [...] |
| 12 | +# |
| 13 | +# julia> include("test/resampling.jl") |
| 14 | +# [...] |
| 15 | +# ``` |
| 16 | +include("preliminaries.jl") |
63 | 17 |
|
64 | 18 | @conditional_testset "misc" begin
|
65 | 19 | @test include("utilities.jl")
|
|
0 commit comments