Skip to content

Commit

Permalink
Fix som_plantmeter tests
Browse files Browse the repository at this point in the history
  • Loading branch information
oriolpiera committed Mar 4, 2024
1 parent b691e54 commit 73ced59
Show file tree
Hide file tree
Showing 5 changed files with 283 additions and 266 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/som_plantmeter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# This workflow will pass tests of module passed by input

name: som_plantmeter
on:
workflow_dispatch:
pull_request: # PR
jobs:
erp-tests-module:
uses: Som-Energia/openerp_som_addons/.github/workflows/reusable_workflow.yml@main
with:
module: som_plantmeter
secrets:
ACCESS_TOKEN_GA: ${{ secrets.ACCESS_TOKEN_GA }}
ESIOS_TOKEN: ${{ secrets.ESIOS_TOKEN }}
SRID: ${{ secrets.SRID }}

5 changes: 4 additions & 1 deletion plantmeter/testutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ def sorteddict(d):

def _inProduction():
import erppeek_wst
import dbconfig
try:
import dbconfig
except ImportError:
return True
c = erppeek_wst.ClientWST(**dbconfig.erppeek)
c.begin()
destructive_testing_allowed = c._execute(
Expand Down
4 changes: 2 additions & 2 deletions som_plantmeter/som_plantmeter.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from datetime import datetime
from plantmeter.resource import ProductionAggregator, ProductionPlant, ProductionMeter
from plantmeter.mongotimecurve import MongoTimeCurve, toLocal, asUtc
from somutils.isodates import isodate, naiveisodatetime, localisodate
from somutils.isodates import isodate, localisodate

class GenerationkwhProductionAggregator(osv.osv):
"""
Expand Down Expand Up @@ -276,7 +276,7 @@ def fillMeasurementPoint(self, cursor, uid, pointTime, name, value, context=None
timestampField = 'utc_gkwh_timestamp',
)
curveProvider.fillPoint(
datetime=toLocal(asUtc(naiveisodatetime(pointTime))),
datetime=toLocal(asUtc(datetime.strptime(pointTime, "%Y-%m-%d"))),
name=name,
ae=value)

Expand Down
1 change: 1 addition & 0 deletions som_plantmeter/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from plantmeter_test import *
Loading

0 comments on commit 73ced59

Please sign in to comment.