# Conditionally running dbt tests / Only running dbt tests in production

**URL:** <https://discourse.getdbt.com/t/conditionally-running-dbt-tests-only-running-dbt-tests-in-production/322>\
**Category:** Archive\
**Created:** [April 29, 2019, 8:44pm UTC](https://discourse.getdbt.com/t/conditionally-running-dbt-tests-only-running-dbt-tests-in-production/322 "2019-04-29T20:44:21Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![bkleszyk](https://avatars.discourse-cdn.com/v4/letter/b/9de0a6/32.png) [@bkleszyk](https://discourse.getdbt.com/u/bkleszyk)\
**Post date:** [April 29, 2019, 9:09pm UTC](https://discourse.getdbt.com/t/conditionally-running-dbt-tests-only-running-dbt-tests-in-production/322/2 "2019-04-29T21:09:24Z")

</div>

If your tests are purely data tests, you can toggle them using a dbt var or environment variable. We’ve used env vars to enable/disable models more easily, and it works for tests too.

```auto
-- tests/t_example.sql
{{
  config(
    enabled=not env_var('DISABLE_RECENCY_CHECK', ''),
  )
}}

SELECT 1

```

and then compare: `DISABLE_RECENCY_CHECK=1 dbt test --model t_example` vs. `dbt test --model t_example`.

---

_[View the full topic](https://discourse.getdbt.com/t/conditionally-running-dbt-tests-only-running-dbt-tests-in-production/322)._
