Skip to content

Commit

Permalink
STH Test: Add failure reason for self test
Browse files Browse the repository at this point in the history
See also: #13
  • Loading branch information
sanssecours committed Dec 3, 2020
1 parent 6afb27a commit 38cb827
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions Documentation/Release Notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
## STH Test

- We now always assume the name of the STH (`STH``Name`) in the [configuration][configuration file] is given as string. This improves the usability of the tests, since otherwise you might specify an integer as name (e.g. `1337`) and wonder why the test is unable to connect to the STH.
- The STH test now prints a message about a possible incorrect config value for the acceleration sensor (`STH``Acceleration Sensor``Sensor`), if [the self test of the accelerometer failed](https://github.com/MyTooliT/ICOc/issues/13).

# Version 1.0.7

Expand Down
8 changes: 6 additions & 2 deletions mytoolit/test/production/sth.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,16 +279,20 @@ def measure_voltage():
f"Self test voltage of {voltage_at_test:.0f} mV was lower " +
f"than voltage after test {voltage_before_test:.0f} mv")

possible_failure_reason = (
f"\n\nPossible Reason:\n\n• Acceleration sensor config value " +
f"“{settings.STH.Acceleration_Sensor.Sensor}” is incorrect")

self.assertGreaterEqual(
voltage_diff, voltage_diff_minimum,
f"Measured voltage difference of {voltage_diff:.0f} mV is lower " +
"than expected minimum voltage difference of " +
f"{voltage_diff_minimum:.0f} mV")
f"{voltage_diff_minimum:.0f} mV{possible_failure_reason}")
self.assertLessEqual(
voltage_diff, voltage_diff_maximum,
f"Measured voltage difference of {voltage_diff:.0f} mV is " +
"greater than expected minimum voltage difference of " +
f"{voltage_diff_maximum:.0f} mV")
f"{voltage_diff_maximum:.0f} mV{possible_failure_reason}")

def test_eeprom(self):
"""Test if reading and writing the EEPROM works"""
Expand Down

0 comments on commit 38cb827

Please sign in to comment.