Skip to content

Commit 7947544

Browse files
authored
docs for fixture generation (#1787)
* docs for fixture generation * PR feedback
1 parent d3c23f8 commit 7947544

File tree

2 files changed

+69
-0
lines changed

2 files changed

+69
-0
lines changed

docs/contributing.rst

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,75 @@ To issue an unstable version when the current version is stable, specify the new
255255
version explicitly, like ``make release bump="--new-version 4.0.0-alpha.1 devnum"``.
256256

257257

258+
Generating new fixtures
259+
~~~~~~~~~~~~~~~~~~~~~~~
260+
261+
Our integration tests make use of Geth and Parity/OpenEthereum private networks.
262+
When new versions of the client software are introduced, new fixtures should be
263+
generated.
264+
265+
.. note::
266+
267+
A "fixture" is a pre-synced network. It's the result of configuring and running
268+
a client, deploying the test contracts, and saving the resulting state for
269+
testing Web3.py functionality against.
270+
271+
272+
Geth fixtures
273+
^^^^^^^^^^^^^
274+
275+
1. Install the desired Geth version on your machine locally. The Geth team only
276+
explicitly supports the current version of their client at any given point,
277+
so older versions are best installed via `py-geth`_. Note that ``py-geth``
278+
will need updating to support each new version as well.
279+
280+
2. Specify the Geth binary and run the fixture creation script:
281+
282+
.. code:: sh
283+
284+
$ GETH_BINARY=/path/to/py-geth/bin python /tests/integration/generate_fixtures/go_ethereum.py /tests/integration/geth-X.Y.Z-fixture
285+
286+
3. The output of this script is your fixture, a zip file. Store the fixture in the
287+
``/tests/integration/`` directory and update the ``/tests/integration/go_ethereum/conftest.py``
288+
file to point to the new fixture.
289+
290+
4. Run the tests. To ensure that the tests run with the correct Geth version,
291+
you may again include the ``GETH_BINARY`` environment variable.
292+
293+
294+
Parity/OpenEthereum fixtures
295+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
296+
297+
1. The most reliable way to get a specific Parity/OE binary is to download
298+
the source code via `GitHub releases`_.
299+
300+
2. `Build the binary`_ from source. (This is will take a few minutes.)
301+
302+
3. Specify the path to this binary in the ``get_parity_binary`` function
303+
of the ``/tests/integration/generate_fixtures/parity.py`` file.
304+
305+
4. Run the fixture generation script:
306+
307+
.. code:: sh
308+
309+
$ python /tests/integration/generate_fixtures/parity.py /tests/integration/parity-X.Y.Z-fixture
310+
311+
5. The output of this script is your fixture, a zip file. Store the fixture in the
312+
``/tests/integration/`` directory and update the ``/tests/integration/parity/conftest.py``
313+
file to point the new fixture.
314+
315+
6. By this point, you may have noticed that Parity fixture generation relies
316+
on a Geth network to sync from. In the output of the generation script are
317+
the hashes of the various contracts that it mined. Update the corresponding
318+
values in the ``/parity/conftest.py`` file with those hashes.
319+
320+
7. Run the tests.
321+
322+
258323
.. _style guide: https://github.com/pipermerriam/ethereum-dev-tactical-manual/blob/master/style-guide.md
259324
.. _type hints: https://www.python.org/dev/peps/pep-0484/
260325
.. _how to create documentation: https://github.com/ethereum/snake-charmers-tactical-manual/blob/master/documentation.md
261326
.. _working on pull requests: https://help.github.com/articles/about-pull-requests/
327+
.. _py-geth: https://github.com/ethereum/py-geth
328+
.. _Github releases: https://github.com/openethereum/openethereum/releases
329+
.. _Build the binary: https://github.com/openethereum/openethereum/#3-building-

newsfragments/1787.doc.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Document Geth and Parity/OpenEthereum fixture generation

0 commit comments

Comments
 (0)