Skip to content

Commit

Permalink
Fix tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
dboulware committed Jan 17, 2024
1 parent e35274f commit e5f5ac2
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 18 deletions.
8 changes: 4 additions & 4 deletions scos_actions/actions/acquire_sea_data_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
from environs import Env
from its_preselector import __version__ as PRESELECTOR_API_VERSION
from scipy.signal import sos2tf, sosfilt

from scos_actions import __version__ as SCOS_ACTIONS_VERSION
from scos_actions import utils
from scos_actions.actions.interfaces.action import Action
from scos_actions.hardware.sensor import Sensor
from scos_actions.hardware.utils import (
Expand Down Expand Up @@ -73,9 +76,6 @@
from scos_actions.signals import measurement_action_completed, trigger_api_restart
from scos_actions.utils import convert_datetime_to_millisecond_iso_format, get_days_up

from scos_actions import __version__ as SCOS_ACTIONS_VERSION
from scos_actions import utils

env = Env()
logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -766,7 +766,7 @@ def capture_diagnostics(
except:
logger.warning("Failed to get SCOS start time")
try: # SCOS uptime
cpu_diag["software_uptime"] = get_days_up()
cpu_diag["software_uptime"] = get_days_up(self.sensor.start_time)
except:
logger.warning("Failed to get SCOS uptime")
try: # SSD SMART data
Expand Down
9 changes: 1 addition & 8 deletions scos_actions/discover/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,8 @@
from scos_actions.actions.monitor_sigan import MonitorSignalAnalyzer
from scos_actions.actions.sync_gps import SyncGps
from scos_actions.discover.yaml import load_from_yaml
from scos_actions.hardware.mocks.mock_gps import MockGPS
from scos_actions.hardware.mocks.mock_sigan import MockSignalAnalyzer
from scos_actions.settings import ACTION_DEFINITIONS_DIR, MOCK_SIGAN
from scos_actions.signals import register_component_with_status
from scos_actions.settings import ACTION_DEFINITIONS_DIR

mock_sigan = MockSignalAnalyzer(randomize_values=True)
mock_gps = MockGPS()
if MOCK_SIGAN:
register_component_with_status.send(mock_sigan.__class__, component=mock_sigan)
actions = {"logger": Logger()}
test_actions = {
"test_sync_gps": SyncGps(parameters={"name": "test_sync_gps"}),
Expand Down
6 changes: 3 additions & 3 deletions scos_actions/hardware/sensor.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import hashlib
import json
from datetime import datetime
import datetime
from typing import Dict

from its_preselector.preselector import Preselector
Expand Down Expand Up @@ -28,7 +28,7 @@ def __init__(
self._switches = switches
self._location = location
self.capabilities = capabilities
self.start_time = datetime.datetime.utcnow()
self_start_time = datetime.datetime.utcnow()

@property
def signal_analyzer(self) -> SignalAnalyzerInterface:
Expand Down Expand Up @@ -103,4 +103,4 @@ def has_configurable_preselector(self) -> bool:

@property
def start_time(self):
return self.start_time
return self._start_time
4 changes: 1 addition & 3 deletions scos_actions/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@

from dateutil import parser

from scos_actions.status import start_time

logger = logging.getLogger(__name__)


Expand Down Expand Up @@ -121,7 +119,7 @@ def get_parameter(p: str, params: dict):
return params[p]


def get_days_up():
def get_days_up(start_time):
elapsed = datetime.utcnow() - start_time
days = elapsed.days
fractional_day = elapsed.seconds / (60 * 60 * 24)
Expand Down

0 comments on commit e5f5ac2

Please sign in to comment.