def test_train_with_historical_forecasts_with_covs(self, config):
        """
        config[0] : both ocl = 1, covs are long enough
        config[1] : both ocl are multiple, covs are long enough
        config[2] : ocl1 multiple, ocl2 not multiple
        """
        ocl1, ocl2 = config
        regression_train_n_points = 10
        # shortening the series to make test simpler, 10 for forecasting models, 20 for the regression model
        ts = self.combined[:30]

        # past covariates starts 5 steps before the target series
        past_covs = tg.linear_timeseries(
            start=ts.start_time() - 5 * ts.freq,
            length=len(ts) + 5,
        )

        ensemble = RegressionEnsembleModel(
            forecasting_models=[
                LinearRegressionModel(
                    lags=5, lags_past_covariates=5, output_chunk_length=ocl1
                ),
                LinearRegressionModel(
                    lags=2, lags_past_covariates=5, output_chunk_length=ocl2
                ),
            ],
            regression_train_n_points=regression_train_n_points,
            train_using_historical_forecasts=True,
        )
        # covariates have the appropriate length
        ensemble.fit(ts, past_covariates=past_covs)
        assert (
            len(ensemble.regression_model.training_series) == regression_train_n_points
        )
        # since past covariates extend far in the past, they are available for the regression model

        # future covariates finishes 5 steps after the target series
        future_covs = tg.linear_timeseries(
            start=ts.start_time(),
            length=len(ts) + 2,
        )

        ensemble = RegressionEnsembleModel(
            forecasting_models=[
                LinearRegressionModel(
                    lags=2, lags_future_covariates=[1, 2], output_chunk_length=ocl1
                ),
                LinearRegressionModel(
                    lags=1, lags_future_covariates=[1, 2], output_chunk_length=ocl2
                ),
            ],
            regression_train_n_points=regression_train_n_points,
            train_using_historical_forecasts=True,
        )

        # covariates have the appropriate length
        ensemble.fit(ts, future_covariates=future_covs)
        assert (
            len(ensemble.regression_model.training_series) == regression_train_n_points
        )

        with pytest.raises(ValueError):
            # covariates are too short (ends too early)
            ensemble.fit(ts, future_covariates=future_covs[: -min(ocl1, ocl2)])

        config[0] : both ocl = 1, covs are long enough
        config[1] : both ocl are multiple, covs are long enough
        config[2] : ocl1 multiple, ocl2 not multiple
        
darts/tests/models/forecasting/test_regression_ensemble_model.py