|
| 1 | +History |
| 2 | +======= |
| 3 | + |
| 4 | +pytest has a long and interesting history. The `first commit |
| 5 | +<https://github.com/pytest-dev/pytest/commit/5992a8ef21424d7571305a8d7e2a3431ee7e1e23>`__ |
| 6 | +in this repository is from January 2007, and even that commit alone already |
| 7 | +tells a lot: The repository originally was from the `py |
| 8 | +<https://pypi.org/project/py/>`__ library (later split off to pytest), and it |
| 9 | +originally was a SVN revision, migrated to Mercurial, and finally migrated to |
| 10 | +git. |
| 11 | + |
| 12 | +However, the commit says “create the new development trunk” and is |
| 13 | +already quite big: *435 files changed, 58640 insertions(+)*. This is because |
| 14 | +pytest originally was born as part of `PyPy <https://www.pypy.org/>`__, to make |
| 15 | +it easier to write tests for it. Here's how it evolved from there to its own |
| 16 | +project: |
| 17 | + |
| 18 | + |
| 19 | +- Late 2002 / early 2003, `PyPy was |
| 20 | + born <https://morepypy.blogspot.com/2018/09/the-first-15-years-of-pypy.html>`__. |
| 21 | +- Like that blog post mentioned, from very early on, there was a big |
| 22 | + focus on testing. There were various ``testsupport`` files on top of |
| 23 | + unittest.py, and as early as June 2003, Holger Krekel (`@hpk42 <https://github.com/hpk42>`__) |
| 24 | + `refactored <https://mail.python.org/pipermail/pypy-dev/2003-June/000787.html>`__ |
| 25 | + its test framework to clean things up (``pypy.tool.test``, but still |
| 26 | + on top of ``unittest.py``, with nothing pytest-like yet). |
| 27 | +- In December 2003, there was `another |
| 28 | + iteration <https://foss.heptapod.net/pypy/pypy/-/commit/02752373e1b29d89c6bb0a97e5f940caa22bdd63>`__ |
| 29 | + at improving their testing situation, by Stefan Schwarzer, called |
| 30 | + ``pypy.tool.newtest``. |
| 31 | +- However, it didn’t seem to be around for long, as around June/July |
| 32 | + 2004, efforts started on a thing called ``utest``, offering plain |
| 33 | + assertions. This seems like the start of something pytest-like, but |
| 34 | + unfortunately, it's unclear where the test runner's code was at the time. |
| 35 | + The closest thing still around is `this |
| 36 | + file <https://foss.heptapod.net/pypy/pypy/-/commit/0735f9ed287ec20950a7dd0a16fc10810d4f6847>`__, |
| 37 | + but that doesn’t seem like a complete test runner at all. What can be seen |
| 38 | + is that there were `various |
| 39 | + efforts <https://foss.heptapod.net/pypy/pypy/-/commits/branch/default?utf8=%E2%9C%93&search=utest>`__ |
| 40 | + by Laura Creighton and Samuele Pedroni (`@pedronis <https://github.com/pedronis>`__) at automatically |
| 41 | + converting existing tests to the new ``utest`` framework. |
| 42 | +- Around the same time, for Europython 2004, @hpk42 `started a |
| 43 | + project <http://web.archive.org/web/20041020215353/http://codespeak.net/svn/user/hpk/talks/std-talk.txt>`__ |
| 44 | + originally called “std”, intended to be a “complementary standard |
| 45 | + library” - already laying out the principles behind what later became |
| 46 | + pytest: |
| 47 | + |
| 48 | + - current “batteries included” are very useful, but |
| 49 | + |
| 50 | + - some of them are written in a pretty much java-like style, |
| 51 | + especially the unittest-framework |
| 52 | + - […] |
| 53 | + - the best API is one that doesn’t exist |
| 54 | + |
| 55 | + […] |
| 56 | + |
| 57 | + - a testing package should require as few boilerplate code as |
| 58 | + possible and offer much flexibility |
| 59 | + - it should provide premium quality tracebacks and debugging aid |
| 60 | + |
| 61 | + […] |
| 62 | + |
| 63 | + - first of all … forget about limited “assertXYZ APIs” and use the |
| 64 | + real thing, e.g.:: |
| 65 | + |
| 66 | + assert x == y |
| 67 | + |
| 68 | + - this works with plain python but you get unhelpful “assertion |
| 69 | + failed” errors with no information |
| 70 | + |
| 71 | + - std.utest (magic!) actually reinterprets the assertion expression |
| 72 | + and offers detailed information about underlying values |
| 73 | + |
| 74 | +- In September 2004, the ``py-dev`` mailinglist gets born, which `is |
| 75 | + now <https://mail.python.org/pipermail/pytest-dev/>`__ ``pytest-dev``, |
| 76 | + but thankfully with all the original archives still intact. |
| 77 | + |
| 78 | +- Around September/October 2004, the ``std`` project `was renamed |
| 79 | + <https://mail.python.org/pipermail/pypy-dev/2004-September/001565.html>`__ to |
| 80 | + ``py`` and ``std.utest`` became ``py.test``. This is also the first time the |
| 81 | + `entire source |
| 82 | + code <https://foss.heptapod.net/pypy/pypy/-/commit/42cf50c412026028e20acd23d518bd92e623ac11>`__, |
| 83 | + seems to be available, with much of the API still being around today: |
| 84 | + |
| 85 | + - ``py.path.local``, which is being phased out of pytest (in favour of |
| 86 | + pathlib) some 16-17 years later |
| 87 | + - The idea of the collection tree, including ``Collector``, |
| 88 | + ``FSCollector``, ``Directory``, ``PyCollector``, ``Module``, |
| 89 | + ``Class`` |
| 90 | + - Arguments like ``-x`` / ``--exitfirst``, ``-l`` / |
| 91 | + ``--showlocals``, ``--fulltrace``, ``--pdb``, ``-S`` / |
| 92 | + ``--nocapture`` (``-s`` / ``--capture=off`` today), |
| 93 | + ``--collectonly`` (``--collect-only`` today) |
| 94 | + |
| 95 | +- In the same month, the ``py`` library `gets split off |
| 96 | + <https://foss.heptapod.net/pypy/pypy/-/commit/6bdafe9203ad92eb259270b267189141c53bce33>`__ |
| 97 | + from ``PyPy`` |
| 98 | + |
| 99 | +- It seemed to get rather quiet for a while, and little seemed to happen |
| 100 | + between October 2004 (removing ``py`` from PyPy) and January |
| 101 | + 2007 (first commit in the now-pytest repository). However, there were |
| 102 | + various discussions about features/ideas on the mailinglist, and `a |
| 103 | + couple of |
| 104 | + releases <https://pypi.org/project/py/0.8.0-alpha2/#history>`__ every |
| 105 | + couple of months: |
| 106 | + |
| 107 | + - March 2006: py 0.8.0-alpha2 |
| 108 | + - May 2007: py 0.9.0 |
| 109 | + - March 2008: py 0.9.1 (first release to be found `in the pytest |
| 110 | + changelog <https://github.com/pytest-dev/pytest/blob/main/doc/en/changelog.rst#091>`__!) |
| 111 | + - August 2008: py 0.9.2 |
| 112 | + |
| 113 | +- In August 2009, py 1.0.0 was released, `introducing a lot of |
| 114 | + fundamental |
| 115 | + features <https://holgerkrekel.net/2009/08/04/pylib-1-0-0-released-the-testing-with-python-innovations-continue/>`__: |
| 116 | + |
| 117 | + - funcargs/fixtures |
| 118 | + - A `plugin |
| 119 | + architecture <http://web.archive.org/web/20090629032718/https://codespeak.net/py/dist/test/extend.html>`__ |
| 120 | + which still looks very much the same today! |
| 121 | + - Various `default |
| 122 | + plugins <http://web.archive.org/web/20091005181132/https://codespeak.net/py/dist/test/plugin/index.html>`__, |
| 123 | + including |
| 124 | + `monkeypatch <http://web.archive.org/web/20091012022829/http://codespeak.net/py/dist/test/plugin/monkeypatch.html>`__ |
| 125 | + |
| 126 | +- Even back there, the |
| 127 | + `FAQ <http://web.archive.org/web/20091005222413/http://codespeak.net/py/dist/faq.html>`__ |
| 128 | + said: |
| 129 | + |
| 130 | + Clearly, [a second standard library] was ambitious and the naming has |
| 131 | + maybe haunted the project rather than helping it. There may be a |
| 132 | + project name change and possibly a split up into different projects |
| 133 | + sometime. |
| 134 | + |
| 135 | + and that finally happened in November 2010, when pytest 2.0.0 `was |
| 136 | + released <https://mail.python.org/pipermail/pytest-dev/2010-November/001687.html>`__ |
| 137 | + as a package separate from ``py`` (but still called ``py.test``). |
| 138 | + |
| 139 | +- In August 2016, pytest 3.0.0 `was |
| 140 | + released <https://docs.pytest.org/en/latest/changelog.html#id1313>`__, |
| 141 | + which adds ``pytest`` (rather than ``py.test``) as the recommended |
| 142 | + command-line entry point |
| 143 | + |
| 144 | +Due to this history, it's diffcult to answer the question when pytest was started. |
| 145 | +It depends what point should really be seen as the start of it all. One |
| 146 | +possible interpretation is to pick Europython 2004, i.e. around June/July |
| 147 | +2004. |
0 commit comments