Merge remote-tracking branch 'origin/master' into reports
This commit is contained in:
commit
97289cdfea
|
@ -6,6 +6,7 @@ from typing import Set
|
||||||
import click
|
import click
|
||||||
import click_spinner
|
import click_spinner
|
||||||
import yaml
|
import yaml
|
||||||
|
from ereuse_utils.test import ANY
|
||||||
|
|
||||||
from ereuse_devicehub.client import UserClient
|
from ereuse_devicehub.client import UserClient
|
||||||
from ereuse_devicehub.db import db
|
from ereuse_devicehub.db import db
|
||||||
|
@ -139,6 +140,11 @@ class Dummy:
|
||||||
res=m.Event)
|
res=m.Event)
|
||||||
# todo Receive
|
# todo Receive
|
||||||
|
|
||||||
|
user.get(res=Device, item=sample_pc) # Test
|
||||||
|
anonymous = self.app.test_client()
|
||||||
|
html, _ = anonymous.get(res=Device, item=sample_pc, accept=ANY)
|
||||||
|
assert 'intel core2 duo cpu' in html
|
||||||
|
|
||||||
# For netbook: to preapre -> torepair -> to dispose -> disposed
|
# For netbook: to preapre -> torepair -> to dispose -> disposed
|
||||||
print('⭐ Done.')
|
print('⭐ Done.')
|
||||||
|
|
||||||
|
|
|
@ -745,11 +745,29 @@ class TestDataStorage(Test):
|
||||||
offline_uncorrectable = Column(SmallInteger)
|
offline_uncorrectable = Column(SmallInteger)
|
||||||
remaining_lifetime_percentage = Column(SmallInteger)
|
remaining_lifetime_percentage = Column(SmallInteger)
|
||||||
|
|
||||||
def __str__(self) -> str:
|
def __init__(self, **kwargs) -> None:
|
||||||
return '{}. Lifetime of {:.1f} years'.format(inflection.humanize(self.status),
|
super().__init__(**kwargs)
|
||||||
self.lifetime.days / 365)
|
# As of https://www.backblaze.com/blog/hard-drive-smart-stats/ and
|
||||||
|
# https://www.backblaze.com/blog-smart-stats-2014-8.html
|
||||||
|
# We can guess some future disk failures by analyzing some
|
||||||
|
# SMART data
|
||||||
|
if (self.reallocated_sector_count or 0) > 10:
|
||||||
|
self.incidence = True
|
||||||
|
self.description = 'Warning: Chance of disk failure within a year.'
|
||||||
|
if (self.current_pending_sector_count or 0) > 40 \
|
||||||
|
and (self.reported_uncorrectable_errors or 0) > 10:
|
||||||
|
self.incidence = True
|
||||||
|
self.description = 'Warning: Chance of disk failure within a year.'
|
||||||
|
if not self.assessment:
|
||||||
|
self.incidence = True
|
||||||
|
self.description = 'Warning: Drive failure expected soon.'
|
||||||
|
|
||||||
# todo remove lifetime / passed_lifetime as I think they are the same
|
def __str__(self) -> str:
|
||||||
|
t = inflection.humanize(self.status)
|
||||||
|
if self.lifetime:
|
||||||
|
t += ' with a lifetime of {:.1f} years.'.format(self.lifetime.days / 365)
|
||||||
|
t += self.description
|
||||||
|
return t
|
||||||
|
|
||||||
|
|
||||||
class StressTest(Test):
|
class StressTest(Test):
|
||||||
|
|
|
@ -5,7 +5,7 @@ click==6.7
|
||||||
click-spinner==0.1.8
|
click-spinner==0.1.8
|
||||||
colorama==0.3.9
|
colorama==0.3.9
|
||||||
colour==0.1.5
|
colour==0.1.5
|
||||||
ereuse-utils==0.4.0b9
|
ereuse-utils==0.4.0b10
|
||||||
Flask==1.0.2
|
Flask==1.0.2
|
||||||
Flask-Cors==3.0.6
|
Flask-Cors==3.0.6
|
||||||
Flask-SQLAlchemy==2.3.2
|
Flask-SQLAlchemy==2.3.2
|
||||||
|
@ -25,7 +25,7 @@ requests==2.19.1
|
||||||
requests-mock==1.5.2
|
requests-mock==1.5.2
|
||||||
SQLAlchemy==1.2.11
|
SQLAlchemy==1.2.11
|
||||||
SQLAlchemy-Utils==0.33.3
|
SQLAlchemy-Utils==0.33.3
|
||||||
teal==0.2.0a26
|
teal==0.2.0a28
|
||||||
webargs==4.0.0
|
webargs==4.0.0
|
||||||
Werkzeug==0.14.1
|
Werkzeug==0.14.1
|
||||||
sqlalchemy-citext==1.3.post0
|
sqlalchemy-citext==1.3.post0
|
||||||
|
|
4
setup.py
4
setup.py
|
@ -34,10 +34,10 @@ setup(
|
||||||
long_description=long_description,
|
long_description=long_description,
|
||||||
long_description_content_type='text/markdown',
|
long_description_content_type='text/markdown',
|
||||||
install_requires=[
|
install_requires=[
|
||||||
'teal>=0.2.0a26', # teal always first
|
'teal>=0.2.0a28', # teal always first
|
||||||
'click',
|
'click',
|
||||||
'click-spinner',
|
'click-spinner',
|
||||||
'ereuse-utils[Naming]>=0.4b9',
|
'ereuse-utils[Naming]>=0.4b10',
|
||||||
'hashids',
|
'hashids',
|
||||||
'marshmallow_enum',
|
'marshmallow_enum',
|
||||||
'psycopg2-binary',
|
'psycopg2-binary',
|
||||||
|
|
Reference in a new issue