From d775799f8bcc077802f5ddbdc99ef998f0b87161 Mon Sep 17 00:00:00 2001 From: CamDavidsonPilon Date: Thu, 7 Sep 2023 14:45:58 -0400 Subject: [PATCH] check for Hat in all these tests --- CHANGELOG.md | 5 +++++ pioreactor/actions/self_test.py | 13 ++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a2029edc..6f7e1e80 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +### Upcoming + - When installing plugins, any leader-only commands would not be run. This is fixed. + - Base automations now subclass from `pioreactor.automations.BaseAutomationJob`. Nothing the user needs to worry about. + - Fixed bug that ignored `.yml` files in the UI. + ### 23.8.29 - Pioreactor's IPv4 and hostname is now displayed under System in the UI. - In configuration, renamed section `dosing_automation` to `dosing_automation.config` (only applies to new installs). It's recommended for existing users to make this change, too. diff --git a/pioreactor/actions/self_test.py b/pioreactor/actions/self_test.py index feef5e21..5890f1be 100644 --- a/pioreactor/actions/self_test.py +++ b/pioreactor/actions/self_test.py @@ -63,6 +63,8 @@ def test_REF_is_in_correct_position( # The idea is to trigger stirring on and off and the REF should not see a change in signal / variance, but the other PD should. from statistics import variance + assert is_HAT_present() + reference_channel = cast(PdChannel, config["od_config.photodiode_channel_reverse"][REF_keyword]) signal_channel = "2" if reference_channel == "1" else "1" @@ -120,6 +122,8 @@ def test_all_positive_correlations_between_pds_and_leds( from pprint import pformat from random import shuffle + assert is_HAT_present() + # better to err on the side of MORE samples than less - it's only a few extra seconds... # we randomize to reduce effects of temperature INTENSITIES = list(range(20, 85, 5)) @@ -220,6 +224,8 @@ def test_ambient_light_interference( ) -> None: # test ambient light IR interference. With all LEDs off, and the Pioreactor not in a sunny room, we should see near 0 light. + assert is_HAT_present() + adc_reader = ADCReader( channels=ALL_PD_CHANNELS, dynamic_gain=False, @@ -275,6 +281,8 @@ def test_REF_is_lower_than_0_dot_256_volts( def test_PD_is_near_0_volts_for_blank(client, logger: Logger, unit: str, experiment: str) -> None: + assert is_HAT_present() + reference_channel = cast(PdChannel, config["od_config.photodiode_channel_reverse"][REF_keyword]) signal_channel = "2" if reference_channel == "1" else "1" assert config.get("od_config.photodiode_channel", signal_channel, fallback=None) in [ @@ -330,7 +338,10 @@ def test_positive_correlation_between_temperature_and_heating( assert measured_correlation > 0.9, (dcs, measured_pcb_temps) -def test_aux_power_is_not_too_high(client: Client, logger: Logger, unit: str, experiment: str): +def test_aux_power_is_not_too_high( + client: Client, logger: Logger, unit: str, experiment: str +) -> None: + assert is_HAT_present() assert voltage_in_aux() <= 18.0