|
1 | 1 | include("front_matter.jl") |
2 | 2 |
|
3 | | -@testset "SymbolicRegression.jl" begin |
4 | | - # Validate TEST_GROUP format |
5 | | - if !occursin(r"^(unit|integration)/", TEST_GROUP) |
6 | | - error("TEST_GROUP must start with 'unit/' or 'integration/', got: $(TEST_GROUP)") |
7 | | - end |
| 3 | +if !occursin(r"^(unit|integration)/", TEST_GROUP) |
| 4 | + error("TEST_GROUP must start with 'unit/' or 'integration/', got: $(TEST_GROUP)") |
| 5 | +end |
8 | 6 |
|
9 | | - # Check if this is an integration test |
10 | | - if startswith(TEST_GROUP, "integration/") |
11 | | - # Extract integration name (e.g., "integration/ad/zygote" -> "ad/zygote") |
12 | | - integration_name = replace(TEST_GROUP, "integration/" => "") |
13 | | - integration_dir = joinpath(@__DIR__, "integration", integration_name) |
| 7 | +if startswith(TEST_GROUP, "integration/") |
| 8 | + integration_name = replace(TEST_GROUP, "integration/" => "") |
| 9 | + integration_dir = joinpath(@__DIR__, "integration", integration_name) |
14 | 10 |
|
15 | | - # Validate directory exists |
16 | | - if !isdir(integration_dir) |
17 | | - error("Integration directory does not exist: $(integration_dir)") |
18 | | - end |
| 11 | + if !isdir(integration_dir) |
| 12 | + error("Integration directory does not exist: $(integration_dir)") |
| 13 | + end |
| 14 | + |
| 15 | + using Pkg |
| 16 | + Pkg.activate(integration_dir) |
| 17 | + Pkg.instantiate() |
19 | 18 |
|
20 | | - # Activate the integration environment |
21 | | - # Note: Pkg.test() automatically develops the package being tested, |
22 | | - # so we don't need to manually call Pkg.develop here |
23 | | - using Pkg |
24 | | - Pkg.activate(integration_dir) |
25 | | - # Ensure optional dependencies (e.g. MLJBase, Zygote) are available |
26 | | - # for each integration environment before we run its tests. |
27 | | - Pkg.instantiate() |
28 | | - |
29 | | - # Special case: MLJ integrations run additional setup |
30 | | - if startswith(integration_name, "ext/mlj") |
31 | | - ENV["SYMBOLIC_REGRESSION_IS_TESTING"] = "true" |
32 | | - if integration_name == "ext/mlj/templates" |
33 | | - include(joinpath(@__DIR__, "..", "example.jl")) |
34 | | - include(joinpath(@__DIR__, "..", "examples", "parameterized_function.jl")) |
35 | | - include(joinpath(@__DIR__, "..", "examples", "custom_types.jl")) |
36 | | - end |
| 19 | + if startswith(integration_name, "ext/mlj") |
| 20 | + ENV["SYMBOLIC_REGRESSION_IS_TESTING"] = "true" |
| 21 | + if integration_name == "ext/mlj/templates" |
| 22 | + include(joinpath(@__DIR__, "..", "example.jl")) |
| 23 | + include(joinpath(@__DIR__, "..", "examples", "parameterized_function.jl")) |
| 24 | + include(joinpath(@__DIR__, "..", "examples", "custom_types.jl")) |
37 | 25 | end |
| 26 | + end |
38 | 27 |
|
39 | | - # Run all test items in the integration directory |
40 | | - @run_package_tests( |
41 | | - filter = ti -> startswith(ti.filename, integration_dir), verbose = true |
42 | | - ) |
43 | | - else |
44 | | - # Unit tests |
| 28 | + @run_package_tests( |
| 29 | + filter = ti -> startswith(ti.filename, integration_dir), verbose = true |
| 30 | + ) |
| 31 | +else |
| 32 | + @testset "SymbolicRegression.jl" begin |
45 | 33 | test_dir = joinpath(@__DIR__, TEST_GROUP) |
46 | 34 |
|
47 | | - # Validate directory exists |
48 | 35 | if !isdir(test_dir) |
49 | 36 | error("Test directory does not exist: $(test_dir)") |
50 | 37 | end |
51 | 38 |
|
52 | | - # Run all test items in the directory specified by TEST_GROUP |
53 | 39 | @run_package_tests(filter = ti -> startswith(ti.filename, test_dir), verbose = true) |
54 | 40 | end |
55 | 41 | end |
0 commit comments