# Tooling for separating allocation and coverage tests

**URL:** <https://discourse.julialang.org/t/tooling-for-separating-allocation-and-coverage-tests/134439>\
**Category:** Tooling\
**Tags:** question\
**Created:** [December 8, 2025, 6:25pm UTC](https://discourse.julialang.org/t/tooling-for-separating-allocation-and-coverage-tests/134439 "2025-12-08T18:25:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [December 8, 2025, 6:25pm UTC](https://discourse.julialang.org/t/tooling-for-separating-allocation-and-coverage-tests/134439/1 "2025-12-08T18:25:13Z")

</div>

I understand that running tests with coverage makes information from `@allocated` etc unreliable.

I have found [various](https://discourse.julialang.org/t/tests-fail-on-ci-pass-locally/125140/14) clever [workarounds](https://discourse.julialang.org/t/how-do-i-get-test-coverage-not-to-mess-up-allocated-calculations/128418/4) which, generally

1. run two sets of tests, with and without coverage, by setting `build_is_production_build: true` in the actions file,
2. in the tests code on the Julia side, check for the env variable `BUILD_IS_PRODUCTION_BUILD`,
3. only run allocation tests when this is set.

This is manageable, but seems a bit convoluted, and I would be essentially copy-pasting a bits of code in various places. Is that the best solution, or is there a more streamlined alternative?

---

<div class="post-metadata">

**Author:** ![nsajko](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nsajko/32/221187_2.png) [@nsajko](https://discourse.julialang.org/u/nsajko)\
**Post date:** [December 8, 2025, 7:00pm UTC](https://discourse.julialang.org/t/tooling-for-separating-allocation-and-coverage-tests/134439/2 "2025-12-08T19:00:58Z")

</div>

> [@Tamas\_Papp](#):
>
> convoluted

See relevant discussion in the PR that introduced the workaround:

- [support `GenericMemory` by making the storage type a parameter by nsajko · Pull Request #52 · JuliaArrays/FixedSizeArrays.jl · GitHub](https://github.com/JuliaArrays/FixedSizeArrays.jl/pull/52)
