Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
peterdudfield committed Dec 22, 2023
1 parent 2b02249 commit 4998610
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 11 deletions.
2 changes: 0 additions & 2 deletions pvconsumer/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ def pull_data_and_save(

all_pv_yields_df = []
for pv_system_chunk in pv_system_chunks:

if provider == "pvoutput.org":
# set up pv output.org
pv_output = PVOutput()
Expand Down Expand Up @@ -176,7 +175,6 @@ def pull_data_and_save(
if len(pv_yield_df) == 0:
logger.warning(f"Did not find any data for {pv_system.client_site_id} for {date}")
else:

# filter out which is in our database and a funny 0 bug
pv_yield_df = format_pv_data(
pv_system=pv_system, pv_yield_df=pv_yield_df, session=session
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

import pandas as pd
import pytest
from pvsite_datamodel.connection import DatabaseConnection

# from nowcasting_datamodel.connection import DatabaseConnection
from pvsite_datamodel.sqlmodels import Base, GenerationSQL, SiteSQL
from pvsite_datamodel.connection import DatabaseConnection
from testcontainers.postgres import PostgresContainer

import pvconsumer
Expand Down
5 changes: 2 additions & 3 deletions tests/intergration/test_app.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
from click.testing import CliRunner
from pvconsumer.app import app, pull_data_and_save
from pvsite_datamodel.sqlmodels import GenerationSQL, SiteSQL

from pvconsumer.app import app, pull_data_and_save

def test_pull_data(db_session, sites):

def test_pull_data(db_session, sites):
pull_data_and_save(pv_systems=sites, session=db_session, provider="pvoutput.org")

pv_yields = db_session.query(GenerationSQL).all()
assert len(pv_yields) > 0


def test_pull_data_solar_sheffield(db_session, sites):

pull_data_and_save(pv_systems=sites, session=db_session, provider="solar_sheffield_passiv")

pv_yields = db_session.query(GenerationSQL).all()
Expand Down
3 changes: 2 additions & 1 deletion tests/unittest/test_pv_systems.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
from datetime import datetime

import pandas as pd
from pvsite_datamodel.sqlmodels import GenerationSQL, SiteSQL

from pvconsumer.pv_systems import (
filter_pv_systems_which_have_new_data,
find_missing_pv_systems,
load_pv_systems,
)
from pvconsumer.utils import solar_sheffield_passiv
from pvsite_datamodel.sqlmodels import SiteSQL, GenerationSQL


def test_load_pv_systems():
Expand Down
6 changes: 2 additions & 4 deletions tests/unittest/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
from datetime import datetime, timezone

import pandas as pd
from pvconsumer.utils import format_pv_data
from pvsite_datamodel.sqlmodels import GenerationSQL

from pvconsumer.utils import format_pv_data

def test_pv_yield_df_no_data(db_session, sites):

def test_pv_yield_df_no_data(db_session, sites):
pv_yield_df = pd.DataFrame(columns=["instantaneous_power_gen_W", "datetime"])

pv_yields = format_pv_data(pv_system=sites[0], pv_yield_df=pv_yield_df, session=db_session)
assert len(pv_yields) == 0


def test_pv_yield_df(sites, db_session):

pv_yield_df = pd.DataFrame(
columns=["instantaneous_power_gen_W", "datetime"], data=[[1, datetime(2022, 1, 1)]]
)
Expand Down Expand Up @@ -66,7 +65,6 @@ def test_pv_yield_df_0_bug(sites, db_session):


def test_pv_yield_df_zeros(sites, db_session):

pv_yield_df = pd.DataFrame(
columns=["instantaneous_power_gen_W", "datetime"],
data=[
Expand Down

0 comments on commit 4998610

Please sign in to comment.