# Travis CI fails for Julia v0.7 since Test package missing

**URL:** <https://discourse.julialang.org/t/travis-ci-fails-for-julia-v0-7-since-test-package-missing/13290>\
**Category:** Tooling\
**Created:** [August 12, 2018, 1:09pm UTC](https://discourse.julialang.org/t/travis-ci-fails-for-julia-v0-7-since-test-package-missing/13290 "2018-08-12T13:09:42Z")\
**Posts on this page:** 1\
**Showing post:** 10

<div class="post-metadata">

**Author:** ![MartinOtter](https://avatars.discourse-cdn.com/v4/letter/m/87869e/32.png) [@MartinOtter](https://discourse.julialang.org/u/MartinOtter)\
**Post date:** [September 9, 2018, 12:22pm UTC](https://discourse.julialang.org/t/travis-ci-fails-for-julia-v0-7-since-test-package-missing/13290/10 "2018-09-09T12:22:49Z")

</div>

I finally found a good solution (could be a template for other packages as well):

The source of the problem is that (a) there are external Julia “scripts” under ModiaMath/examples and ModiaMath/test that use package ModiaMath to demonstrate/test its features and (b) these “scripts” import other packages (besides ModiaMath) and the versions of these other packages are not defined. It is of course most natural to exactly use the package versions that are also used inside ModiaMath.

A reasonable solution with Julia 1.0.0 is therefore to **reference extra packages used in examples  
and test via the ModiaMath package**:

```julia
File: ModiaMath/src/ModiaMath.jl
   module ModiaMath
       [....]

       # Add import clauses used in examples and test (if not yet available here)
       import StaticArrays
       import Unitful
       import DataFrames
       @static if VERSION >= v"0.7.0-DEV.2005"
           import LinearAlgebra
           import Test  
       end
   end

File: ModiaMath/examples/Simulate_FreeBodyRotation.jl
   module Simulate_FreeBodyRotation
       using ModiaMath
       using ModiaMath.StaticArrays
       @static if VERSION >= v"0.7.0-DEV.2005"
           using ModiaMath.LinearAlgebra
       end
       [....]
   end

File: ModiaMath/test/runtests.jl
   module Runtests
       @static if VERSION >= v"0.7.0-DEV.2005"
           import ModiaMath
           using ModiaMath.Test
       else
           using Base.Test
       end
       [....]
   end

```

In the project.toml file there is only the `[deps]` section, but no longer `[extras]` and `[targets]` sections.

The only (minor) drawback is that package `Test` is loaded always with ModiaMath, even if it is not used (but I guess this overhead is small). The benefit is that individual Julia scripts under ModiaMath/test can be run directly with `include` which is the standard way how the tests are developed in ModiaMath and in Modia.

It might be useful to support the pattern above directly in the Julia language. Example:

```julia
module MyExample
    using ModiaMath
    using StaticArrays as_in ModiaMath # use same version of StaticArrays as in ModiaMath
end

```

---

_[View the full topic](https://discourse.julialang.org/t/travis-ci-fails-for-julia-v0-7-since-test-package-missing/13290)._
