Skip to content

Commit 87c220f

Browse files
more
1 parent 2888382 commit 87c220f

File tree

12 files changed

+23
-100
lines changed

12 files changed

+23
-100
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ check-env: ## Verify required environment variables are loaded
5858

5959
# --- environment --------------------------------------------------------------
6060
$(VENV_DIR)/bin/activate: ## Create virtual env + core tooling
61-
@echo ">> Creating virtual env in $(VENV_DIR)"
61+
@echo ">> Creating virtual env in $(VENV_DIR) with $(PYTHON)"
6262
@$(PYTHON) -m venv $(VENV_DIR)
6363
@$(ACTIVATE) && pip install -U pip wheel $(PIP_FLAGS)$(newline)
6464
@touch $@
@@ -124,7 +124,7 @@ huey-dev: venv ## Run the Huey consumer with sensible dev flags
124124
clean: ## Delete bytecode, build artefacts, node deps
125125
rm -rf $(VENV_DIR) dist/ build/ *.egg-info
126126
find . -name '__pycache__' -exec rm -rf {} +
127-
rm -rf $(NODE_DIR)/build node_modules .pytest_cache
127+
rm -rf $(NODE_DIR)/build node_modules .pytest_cache .pioreactor/storage/local_intermittent_pioreactor_metadata.sqlite .pioreactor/storage/local_persistent_pioreactor_metadata.sqlite
128128

129129
reinstall: clean install frontend-install ## Freshen everything
130130

core/pioreactor/background_jobs/od_reading.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1180,7 +1180,7 @@ def record_from_adc(self) -> structs.ODReadings | None:
11801180
self._log_relative_intensity_of_ir_led()
11811181
self._unblock_internal_event()
11821182

1183-
return od_readings
1183+
return od_readings
11841184

11851185
def start_ir_led(self) -> None:
11861186
r = led_utils.led_intensity(

core/pytest.ini

Lines changed: 0 additions & 2 deletions
This file was deleted.

core/tests/test_dosing_automation.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@ def test_cant_change_target_in_turbidostat() -> None:
341341
assert algo.target_normalized_od is None
342342

343343

344+
@pytest.mark.slow
344345
def test_turbidostat_targeting_od() -> None:
345346
experiment = "test_turbidostat_targeting_od"
346347

@@ -752,6 +753,7 @@ def test_execute_io_action() -> None:
752753
assert ca.current_volume_ml == 15.0
753754

754755

756+
@pytest.mark.slow
755757
def test_execute_io_action2() -> None:
756758
experiment = "test_execute_io_action2"
757759

@@ -1147,6 +1149,7 @@ def test_strings_are_okay_for_chemostat(fast_dosing_timers) -> None:
11471149
assert wait_for(lambda: close(chemostat.media_throughput, 0.7), timeout=5.0)
11481150

11491151

1152+
@pytest.mark.slow
11501153
def test_chemostat_from_cli() -> None:
11511154
from pioreactor.cli.pio import pio
11521155

@@ -1231,6 +1234,7 @@ def test_chemostat_from_0_volume(fast_dosing_timers) -> None:
12311234
assert wait_for(lambda: close(chemostat.current_volume_ml, 1.0), timeout=5.0)
12321235

12331236

1237+
@pytest.mark.slow
12341238
def test_execute_io_respects_dilutions_ratios(fast_dosing_timers) -> None:
12351239
# https://forum.pioreactor.com/t/inconsistent-dosing-behavior-with-multiple-media/37/3
12361240

core/tests/test_execute_experiment_profile.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ def test_execute_experiment_log_actions(mock__load_experiment_profile, active_wo
196196
]
197197

198198

199+
@pytest.mark.slow
199200
@patch("pioreactor.actions.leader.experiment_profile._load_experiment_profile")
200201
def test_execute_experiment_start_and_stop_automations(mock__load_experiment_profile) -> None:
201202
experiment = "_testing_experiment"
@@ -213,6 +214,7 @@ def test_execute_experiment_start_and_stop_automations(mock__load_experiment_pro
213214
execute_experiment_profile("profile.yaml", experiment)
214215

215216

217+
@pytest.mark.slow
216218
@patch("pioreactor.actions.leader.experiment_profile._load_experiment_profile")
217219
def test_execute_experiment_update_automation(mock__load_experiment_profile) -> None:
218220
experiment = "_testing_experiment"
@@ -237,6 +239,7 @@ def test_execute_experiment_update_automation(mock__load_experiment_profile) ->
237239
execute_experiment_profile("profile.yaml", experiment)
238240

239241

242+
@pytest.mark.slow
240243
@patch("pioreactor.actions.leader.experiment_profile._load_experiment_profile")
241244
def test_execute_experiment_start_automation_succeeds(
242245
mock__load_experiment_profile,

core/tests/test_led_automation.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def test_light_dark_cycle_starts_on() -> None:
8484
assert c["C"] == 50
8585

8686

87-
@pytest.mark.skip(reason="flaky in CI")
87+
@pytest.mark.flakey
8888
def test_light_dark_cycle_turns_off_after_N_cycles() -> None:
8989
experiment = "test_light_dark_cycle_turns_off_after_N_cycles"
9090
unit = get_unit_name()
@@ -109,7 +109,7 @@ def test_light_dark_cycle_turns_off_after_N_cycles() -> None:
109109
assert c["C"] == 0.0
110110

111111

112-
@pytest.mark.skip(reason="flaky in CI")
112+
@pytest.mark.flakey
113113
def test_dark_duration_hour_to_zero() -> None:
114114
experiment = "test_dark_duration_hour_to_zero"
115115
unit = get_unit_name()
@@ -139,7 +139,7 @@ def test_dark_duration_hour_to_zero() -> None:
139139
assert c["C"] == 50.0
140140

141141

142-
@pytest.mark.skip(reason="flaky in CI")
142+
@pytest.mark.flakey
143143
def test_light_duration_hour_to_zero() -> None:
144144
experiment = "test_light_duration_hour_to_zero"
145145
unit = get_unit_name()
@@ -159,7 +159,7 @@ def test_light_duration_hour_to_zero() -> None:
159159
assert not lc.light_active
160160

161161

162-
@pytest.mark.skip(reason="flaky in CI")
162+
@pytest.mark.flakey
163163
def test_add_dark_duration_minutes() -> None:
164164
experiment = "test_add_dark_duration_minutes * 60"
165165
unit = get_unit_name()
@@ -189,7 +189,7 @@ def test_add_dark_duration_minutes() -> None:
189189
assert c["C"] == 0.0
190190

191191

192-
@pytest.mark.skip(reason="flaky in CI")
192+
@pytest.mark.flakey
193193
def test_remove_dark_duration_minutes() -> None:
194194
experiment = "test_remove_dark_duration_minutes * 60"
195195
unit = get_unit_name()
@@ -223,7 +223,7 @@ def test_remove_dark_duration_minutes() -> None:
223223
assert c["C"] == 50.0
224224

225225

226-
@pytest.mark.skip(reason="flaky in CI")
226+
@pytest.mark.flakey
227227
def test_fractional_hours() -> None:
228228
experiment = "test_fractional_hours"
229229
unit = get_unit_name()

core/tests/test_mqtt_to_db_streaming.py

Lines changed: 0 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,17 @@
11
# -*- coding: utf-8 -*-
22
from __future__ import annotations
33

4-
import json
54
import sqlite3
65
from time import sleep
76

87
import pioreactor.background_jobs.leader.mqtt_to_db_streaming as m2db
9-
import pytest
108
from pioreactor import mureq
119
from pioreactor import structs
1210
from pioreactor.automations import temperature # noqa: F401
1311
from pioreactor.background_jobs.base import BackgroundJob
14-
from pioreactor.background_jobs.growth_rate_calculating import GrowthRateCalculator
15-
from pioreactor.background_jobs.od_reading import start_od_reading
1612
from pioreactor.config import config
17-
from pioreactor.config import temporary_config_changes
1813
from pioreactor.pubsub import collect_all_logs_of_level
1914
from pioreactor.pubsub import publish
20-
from pioreactor.utils import local_persistent_storage
2115
from pioreactor.utils.timing import current_utc_datetime
2216
from pioreactor.whoami import get_testing_experiment_name
2317
from pioreactor.whoami import get_unit_name
@@ -96,7 +90,6 @@ def test_updated_heater_dc() -> None:
9690
assert len(results) == 1
9791

9892

99-
@pytest.mark.xfail()
10093
def test_dosing_events_land_in_db() -> None:
10194
from pioreactor.actions.pump import add_media
10295

@@ -153,88 +146,6 @@ def test_dosing_events_land_in_db() -> None:
153146
assert len(results) == 2
154147

155148

156-
@pytest.mark.xfail(reason="we stopped adding to kalman filter table in 25.1.x release")
157-
def test_kalman_filter_entries() -> None:
158-
with temporary_config_changes(
159-
config,
160-
[
161-
("storage", "database", "test.sqlite"),
162-
("od_reading.config", "samples_per_second", "0.2"),
163-
("od_config.photodiode_channel", "1", "135"),
164-
("od_config.photodiode_channel", "2", "90"),
165-
],
166-
):
167-
unit = "unit"
168-
exp = "test_kalman_filter_entries"
169-
170-
# init the database
171-
connection = sqlite3.connect(config["storage"]["database"])
172-
cursor = connection.cursor()
173-
174-
cursor.executescript("DROP TABLE IF EXISTS kalman_filter_outputs;")
175-
cursor.executescript(
176-
mureq.get(
177-
"https://raw.githubusercontent.com/Pioreactor/CustoPiZer/pioreactor/workspace/scripts/files/sql/create_tables.sql"
178-
).content.decode("utf-8")
179-
)
180-
connection.commit()
181-
182-
with local_persistent_storage("od_normalization_mean") as cache:
183-
cache[exp] = json.dumps({"1": 0.5, "2": 0.5})
184-
185-
with local_persistent_storage("od_normalization_variance") as cache:
186-
cache[exp] = json.dumps({"1": 1e-6, "2": 1e-4})
187-
188-
# turn on our mqtt to db
189-
parsers = [
190-
m2db.TopicToParserToTable(
191-
"pioreactor/+/+/growth_rate_calculating/kalman_filter_outputs",
192-
m2db.parse_kalman_filter_outputs,
193-
"kalman_filter_outputs",
194-
)
195-
]
196-
197-
# turn on data collection
198-
interval = 0.5
199-
200-
with (
201-
start_od_reading(
202-
{"1": "135", "2": "90"},
203-
interval=interval,
204-
fake_data=True,
205-
unit=unit,
206-
experiment=exp,
207-
),
208-
GrowthRateCalculator(unit=unit, experiment=exp),
209-
m2db.MqttToDBStreamer(unit, exp, parsers),
210-
):
211-
# let data collect
212-
sleep(10)
213-
214-
cursor.execute("SELECT * FROM kalman_filter_outputs WHERE experiment = ?", (exp,))
215-
results = cursor.fetchall()
216-
assert len(results) > 0
217-
218-
cursor.execute(
219-
"SELECT state_0, state_1, state_2 FROM kalman_filter_outputs WHERE experiment = ? ORDER BY timestamp DESC LIMIT 1",
220-
(exp,),
221-
)
222-
results = cursor.fetchone()
223-
assert results[0] != 0.0
224-
assert results[1] != 0.0
225-
assert results[2] != 0.0
226-
227-
cursor.execute(
228-
"SELECT cov_00, cov_11, cov_22 FROM kalman_filter_outputs WHERE experiment = ? ORDER BY timestamp DESC LIMIT 1",
229-
(exp,),
230-
)
231-
results = cursor.fetchone()
232-
233-
assert results[0] != 0.0
234-
assert results[1] != 0.0
235-
assert results[2] != 0.0
236-
237-
238149
def test_empty_payload_is_filtered_early() -> None:
239150
unit = "unit"
240151
exp = "test_empty_payload_is_filtered_early"

core/tests/test_od_reading.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -664,6 +664,7 @@ def cb(od_job):
664664
ODReader._pre_read.clear()
665665

666666

667+
@pytest.mark.slow
667668
def test_add_post_read_callback() -> None:
668669
def cb(self, batched_readings, *args):
669670
self.logger.critical(f"{batched_readings=}")
@@ -1146,6 +1147,7 @@ def capture_led_state_during_offset(batched_readings):
11461147
assert led_states_seen[0] == {channel: pytest.approx(0.0) for channel in ALL_LED_CHANNELS}
11471148

11481149

1150+
@pytest.mark.slow
11491151
def test_ODReader_with_multiple_angles_and_a_ref() -> None:
11501152
"""
11511153
Technically not possible, since there are only two PD channels.

core/tests/test_pumps.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,7 @@ def collect_pwm_updates(msg):
392392
assert update == r"{}"
393393

394394

395+
@pytest.mark.slow
395396
def test_published_mqtt_data_is_the_same_as_requested() -> None:
396397
exp = "test_manually_doesnt_trigger_pwm_dcs"
397398

core/tests/test_stirring.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ def test_publish_target_rpm() -> None:
100100
assert float(message.payload) == 500
101101

102102

103+
@pytest.mark.slow
103104
def test_publish_measured_rpm() -> None:
104105
exp = "test_publish_measured_rpm"
105106

@@ -239,6 +240,7 @@ def test_target_rpm_during_od_reading_defaults_to_zero() -> None:
239240
assert st.target_rpm_outside_od_reading == 500
240241

241242

243+
@pytest.mark.slow
242244
def test_block_until_rpm_is_close_to_target_will_timeout() -> None:
243245
exp = "test_block_until_rpm_is_close_to_target_will_timeout"
244246
rpm_calculator = RpmCalculator()

0 commit comments

Comments
 (0)