diff --git a/india_forecast_app/app.py b/india_forecast_app/app.py index be7ad87..d1a4e41 100644 --- a/india_forecast_app/app.py +++ b/india_forecast_app/app.py @@ -267,15 +267,15 @@ def save_forecast( help="Set the python logging log level", show_default=True, ) -def app_click(timestamp: dt.datetime | None, write_to_db: bool, log_level: str): +def app(timestamp: dt.datetime | None, write_to_db: bool, log_level: str): """ Main click function for running forecasts for sites in India """ - app(timestamp=timestamp, write_to_db=write_to_db, log_level=log_level) + app_run(timestamp=timestamp, write_to_db=write_to_db, log_level=log_level) -def app(timestamp: dt.datetime | None, write_to_db: bool=False, log_level: str="info"): +def app_run(timestamp: dt.datetime | None, write_to_db: bool=False, log_level: str= "info"): """ Main function for running forecasts for sites in India """ @@ -383,4 +383,4 @@ def app(timestamp: dt.datetime | None, write_to_db: bool=False, log_level: str=" if __name__ == "__main__": - app_click() + app() diff --git a/tests/test_app.py b/tests/test_app.py index d3faf17..050b70f 100644 --- a/tests/test_app.py +++ b/tests/test_app.py @@ -11,8 +11,8 @@ from pvsite_datamodel.sqlmodels import ForecastSQL, ForecastValueSQL, MLModelSQL, SiteAssetType from india_forecast_app.app import ( + app_run, app, - app_click, get_generation_data, get_model, get_sites, @@ -155,7 +155,7 @@ def test_app(write_to_db, db_session, sites, nwp_data, nwp_gfs_data, generation_ if write_to_db: args.append("--write-to-db") - result = run_click_script(app_click, args) + result = run_click_script(app, args) assert result.exit_code == 0 if write_to_db: @@ -176,7 +176,7 @@ def test_app_no_pv_data(db_session, sites, nwp_data, nwp_gfs_data, generation_db args = ["--date", dt.datetime.now(tz=dt.UTC).strftime("%Y-%m-%d-%H-%M")] args.append("--write-to-db") - result = run_click_script(app_click, args) + result = run_click_script(app, args) assert result.exit_code == 0 assert db_session.query(ForecastSQL).count() == init_n_forecasts + 2 @@ -201,4 +201,4 @@ def test_app_client_ad( if hf_token is None: pytest.skip("Hugging Face token not set in environment variables, skipping test.") - app(timestamp=None) + app_run(timestamp=None)