| 1 |
--- |
| 2 |
tags: news, python, non-technical |
| 3 |
date: 2016-10-01 00:00 |
| 4 |
title: Seeking funding for deeper integration between Hypothesis and pytest |
| 5 |
author: drmaciver |
| 6 |
--- |
| 7 |
|
| 8 |
Probably the number one complaint I hear from Hypothesis users is that it |
| 9 |
"doesn't work" with py.test fixtures. [This isn't true](http://hypothesis.works/articles/hypothesis-pytest-fixtures/), |
| 10 |
but it does have one very specific limitation in how it works that annoys people: |
| 11 |
It only runs function scoped fixtures once for the entire test, not once per |
| 12 |
example. Because of the way people use function scoped fixtures for handling |
| 13 |
stateful things like databases, this often causes people problems. |
| 14 |
|
| 15 |
I've been [maintaining for a while](https://github.com/pytest-dev/pytest/issues/916) that |
| 16 |
this is impossible to fix without some changes on the pytest end. |
| 17 |
|
| 18 |
The good news is that this turns out not to be the case. After some conversations with |
| 19 |
pytest developers, some examining of other pytest plugins, and a bunch of prototyping, |
| 20 |
I'm pretty sure it's possible. It's just really annoying and a lot of work. |
| 21 |
|
| 22 |
So that's the good news. The bad news is that this isn't going to happen without |
| 23 |
someone funding the work. |
| 24 |
|
| 25 |
I've now spent about a week of fairly solid work on this, and what I've got is |
| 26 |
quite promising: The core objective of running pytest fixtures for every examples |
| 27 |
works fairly seamlessly. |
| 28 |
|
| 29 |
But it's now in the long tail of problems that will need to be squashed before |
| 30 |
this counts as an actual production ready releasable piece of work. A number of |
| 31 |
things *don't* work. For example, currently it's running some module scoped |
| 32 |
fixtures once per example too, which it clearly shouldn't be doing. It also |
| 33 |
currently has some pretty major performance problems that are bad enough that |
| 34 |
I would consider them release blocking. |
| 35 |
|
| 36 |
As a result I'd estimate there's easily another 2-3 weeks of work needed to |
| 37 |
get this out the door. |
| 38 |
|
| 39 |
Which brings us to the crux of the matter: 2-3 additional weeks of free work |
| 40 |
on top of the one I've already done is 3-4 weeks more free work than I |
| 41 |
particularly want to do on this feature, so without sponsorship it's not |
| 42 |
getting finished. |
| 43 |
|
| 44 |
I typically charge £400/day for work on Hypothesis (this is heavily discounted |
| 45 |
off my normal rates), so 2-3 weeks comes to £4000 to £6000 (roughly $5000 |
| 46 |
to $8000) that has to come from somewhere. |
| 47 |
|
| 48 |
I know there are a number of companies out there using pytest and Hypothesis |
| 49 |
together. I know from the amount of complaining about this integration that |
| 50 |
this is a real problem you're experiencing. So, I think this money should |
| 51 |
come from those companies. Besides helping to support a tool you've already |
| 52 |
got a lot of value out of, this will expand the scope of what you can easily |
| 53 |
test with Hypothesis a lot, and will be hugely beneficial to your bug finding |
| 54 |
efforts. |
| 55 |
|
| 56 |
This is a model that has worked well before with the funding of the recent |
| 57 |
statistics work by [Jean-Louis Fuchs](https://github.com/ganwell) and |
| 58 |
[Adfinis-SyGroup](https://www.adfinis-sygroup.ch/), and I'm confident it can |
| 59 |
work well again. |
| 60 |
|
| 61 |
If you work at such a company and would like to talk about funding some or |
| 62 |
part of this development, please email me at |
| 63 |
[[email protected]](mailto:[email protected]). |