def test_check_repo_and_sensorr_no_external_sensors(): repository = mock.MagicMock(spec=ExternalRepository) repository.get_external_sensors.return_value = [] instance = mock.MagicMock(spec=DagsterInstance) with pytest.raises(click.UsageError, match="There are no sensors defined for repository"): check_repo_and_scheduler(repository, instance)
def test_check_repo_and_scheduler_dagster_home_not_set(): with environ({"DAGSTER_HOME": ""}): repository = mock.MagicMock(spec=ExternalRepository) repository.get_external_sensors.return_value = [mock.MagicMock()] instance = mock.MagicMock(spec=DagsterInstance) with pytest.raises( click.UsageError, match=re.escape("The environment variable $DAGSTER_HOME is not set.") ): check_repo_and_scheduler(repository, instance)