https://dagster.io/ logo
Title
i

Ismael Rodrigues

11/11/2022, 8:46 PM
Hi, guys, sorry to bother you with such a simple question. But does anyone know how to create a test that executes the load repository to verify if it has any errors loading the source code? I got 3 repositories, and when I'm deploying something, I would like to test on the pipeline if the repo was correctly loaded before doing the deployment, so I can avoid seeing the error just when it deploys.
z

Zach

11/11/2022, 9:08 PM
You can just import the repo in a test, and that should ensure that your jobs at least compile. Something like
def test_repo_loads():
    from repo import repo1, repo2, repo3
from repository import default_repo


def test_default_repo_can_load():
    """Should load all definitions (jobs, assets, schedules, etc) from the default repo without errors."""
    default_repo.load_all_definitions()
❤️ 2
i

Ismael Rodrigues

11/11/2022, 9:28 PM
Oh, THANKS A LOT. I'll use this
r

rex

11/11/2022, 9:47 PM
https://github.com/dagster-io/dagster/pull/10493 adding this as an example test 🙂