# How do I test my package while avoiding adding large alternative dependencies?

**URL:** https://discourse.julialang.org/t/how-do-i-test-my-package-while-avoiding-adding-large-alternative-dependencies/90838
**Category:** General Usage
**Created:** [November 26, 2022, 4:28am UTC](https://discourse.julialang.org/t/how-do-i-test-my-package-while-avoiding-adding-large-alternative-dependencies/90838 "2022-11-26T04:28:36Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![kapple](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kapple/32/218915_2.png) [@kapple](https://discourse.julialang.org/u/kapple)
#### Post date: [November 26, 2022, 4:28am UTC](https://discourse.julialang.org/t/how-do-i-test-my-package-while-avoiding-adding-large-alternative-dependencies/90838/1 "2022-11-26T04:28:37Z")

</div>

Two examples of lightweight packages as alternatives to a large package:

- RecipesBase.jl instead of Plots.jl
- OrdinaryDiffEq.jl instead of DifferentialEquations.jl

In both cases, the former is added to a personal package to avoid the sheer size of the latter as a dependency.

For example, in OrdinaryDiffEq.jl, you choose the algorithm. But what if I want to run the same code with `solve` from DifferentialEquations.jl to see what algorithm is chosen for me?

And another example, with RecipesBase.jl I’ll be implementing recipes, but to test them I need to install the Plots.jl package anyway.

Is it as simple as `Pkg.add`ing both the smaller and larger packages to my package, but avoid `import`/`using` them in my source code?

---

<div class="post-metadata">

### Author: ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)
#### Post date: [November 26, 2022, 4:59am UTC](https://discourse.julialang.org/t/how-do-i-test-my-package-while-avoiding-adding-large-alternative-dependencies/90838/2 "2022-11-26T04:59:57Z")

</div>

For RecipesBase: [How to test plot recipes? - #6 by giordano](https://discourse.julialang.org/t/how-to-test-plot-recipes/2648/6).

As a general answer to your question, you can add [test-specific dependencies](https://pkgdocs.julialang.org/v1/creating-packages/#Adding-tests-to-the-package) which will be installed only when running the test, not when using your package normally.

---

<div class="post-metadata">

### Author: ![kapple](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kapple/32/218915_2.png) [@kapple](https://discourse.julialang.org/u/kapple)
#### Post date: [November 26, 2022, 6:01am UTC](https://discourse.julialang.org/t/how-do-i-test-my-package-while-avoiding-adding-large-alternative-dependencies/90838/3 "2022-11-26T06:01:48Z")

</div>

Thanks! This is what I’m looking for I believe.

> [@kapple](#):
>
> For example, in OrdinaryDiffEq.jl, you choose the algorithm. But what if I want to run the same code with `solve` from DifferentialEquations.jl to see what algorithm is chosen for me?

For testing in a different sense, as the above scenario, I’ll need a whole new environment/project to activate, won’t I. It doesn’t make sense to add DifferentialEquations to the `test` environment.

In that case I’ll have to copy my code over, or re-implement just the needed components, and then test with DifferentialEquations.jl replacing OrdinaryDiffEq.jl
