Private
Public Access
1
0

passing tests

This commit is contained in:
Sander Roosendaal
2022-07-11 21:29:09 +02:00
parent 3d62772ed2
commit 868b39cd1f
3 changed files with 8 additions and 14 deletions

View File

@@ -1165,7 +1165,7 @@ def getrowdata_db(id=0, doclean=False, convertnewtons=True,
if data.empty:
rowdata, row = getrowdata(id=id)
if not rowdata.empty:
if not rowdata.empty: # pragma: no cover
data = dataprep(rowdata.df, id=id, bands=True,
barchart=True, otwpower=True)
else:
@@ -1511,7 +1511,7 @@ def add_efficiency(id=0): # pragma: no cover
def dataprep(rowdatadf, id=0, bands=True, barchart=True, otwpower=True,
empower=True, inboard=0.88, forceunit='lbs'):
empower=True, inboard=0.88, forceunit='lbs', debug=False):
if rowdatadf.empty:
return 0
@@ -1803,18 +1803,14 @@ def delete_agegroup_db(age, sex, weightcategory, debug=False):
else: # pragma: no cover
engine = create_engine(database_url, echo=False)
query = sa.text('DELETE from {table} WHERE age={age} and weightcategory = {weightcategory} and sex={sex};'.format(
query = sa.text("DELETE from {table} WHERE age='{age}' and weightcategory='{weightcategory}' and sex='{sex}';".format(
sex=sex,
age=age,
weightcategory=weightcategory,
table='calcagegrouprecords'
))
with engine.connect() as conn, conn.begin():
try:
_ = conn.execute(query)
except Exception as e: # pragma: no cover
print(Exception, e)
print("Database locked")
_ = conn.execute(query)
conn.close()
engine.dispose()
@@ -1934,10 +1930,8 @@ def add_c2_stroke_data_db(strokedata, workoutid, starttimeunix, csvfilename,
res = df.to_csv(csvfilename, index_label='index',
compression='gzip')
try:
data = dataprep(df, id=workoutid, bands=False, debug=debug)
except: # pragma: no cover
return 0
data = dataprep(df, id=workoutid, bands=False, debug=debug)
return data

View File

@@ -5,7 +5,7 @@ CFG = yamjam()['rowsandallapp']
try:
os.environ.setdefault("DJANGO_SETTINGS_MODULE",CFG['settings_name'])
except KeyError:
except KeyError: # pragma: no cover
os.environ.setdefault("DJANGO_SETTINGS_MODULE","rowsandall_app.settings")
from django.core.wsgi import get_wsgi_application

View File

@@ -81,7 +81,7 @@ class AsyncTaskTests(TestCase):
def test_polygons(self):
polygons = GeoPolygon.objects.all()
polygon = polygons[0]
#obj = (polygon.id,polygon.name)