| 1 | --- |
| 2 | tags: news, python, non-technical |
| 3 | date: 2016-07-13 00:00 |
| 4 | title: 3.4.2 Release of Hypothesis for Python |
| 5 | author: drmaciver |
| 6 | --- |
| 7 | |
| 8 | This is a bug fix release, fixing a number of problems with the settings |
| 9 | system: |
| 10 | |
| 11 | * Test functions defined using @given can now be called from other |
| 12 | threads (Issue #337) |
| 13 | * Attempting to delete a settings property would previously have |
| 14 | silently done the wrong thing. Now it raises an AttributeError. |
| 15 | * Creating a settings object with a custom database_file parameter |
| 16 | was silently getting ignored and the default was being used instead. |
| 17 | Now it’s not. |
| 18 | |
| 19 | ## Notes |
| 20 | |
| 21 | For historic reasons, _settings.py had been excluded from the |
| 22 | requirement to have 100% branch coverage. Issue #337 would have been |
| 23 | caught by a coverage requirement: the code in question simply couldn't |
| 24 | have worked, but it was not covered by any tests, so it slipped through. |
| 25 | |
| 26 | As part of the general principle that bugs shouldn't just be fixed |
| 27 | without addressing the reason why the bug slipped through in the first |
| 28 | place, I decided to impose the coverage requirements on _settings.py |
| 29 | as well, which is how the other two bugs were found. Both of these had |
| 30 | code that was never run during tests - in the case of the deletion bug |
| 31 | there was a \_\_delete\_\_ descriptor method that was never being run, |
| 32 | and in the case of the database\_file one there was a check later that |
| 33 | could never fire because the internal \_database field was always being |
| 34 | set in \_\_init\_\_. |
| 35 | |
| 36 | I feel like this experiment thoroughly validated that 100% coverage is a |
| 37 | useful thing to aim for. Unfortunately it also pointed out that the |
| 38 | settings system is *much* more complicated than it needs to be. I'm |
| 39 | unsure what to do about that - some of its functionality is a bit too |
| 40 | baked into the public API to lightly change, and I'm don't think it's |
| 41 | worth breaking that just to simplify the code. |