mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Use pytest-xdist to speed up tests (#1290)
* Run tests in CI using pytest-xdist * Documentation for pytest-xdist Closes #1289
This commit is contained in:
parent
59ef4a20cb
commit
0a7621f96f
5 changed files with 26 additions and 1 deletions
|
|
@ -43,10 +43,28 @@ The next step is to create a virtual environment for your project and use it to
|
|||
|
||||
That last line does most of the work: ``pip install -e`` means "install this package in a way that allows me to edit the source code in place". The ``.[test]`` option means "use the setup.py in this directory and install the optional testing dependencies as well".
|
||||
|
||||
.. _contributing_running_tests:
|
||||
|
||||
Running the tests
|
||||
-----------------
|
||||
|
||||
Once you have done this, you can run the Datasette unit tests from inside your ``datasette/`` directory using `pytest <https://docs.pytest.org/>`__ like so::
|
||||
|
||||
pytest
|
||||
|
||||
You can run the tests faster using multiple CPU cores with `pytest-xdist <https://pypi.org/project/pytest-xdist/>`__ like this::
|
||||
|
||||
pytest -n auto -m "not serial"
|
||||
|
||||
``-n auto`` detects the number of available cores automatically. The ``-m "not serial"`` skips tests that don't work well in a parallel test environment. You can run those tests separately like so::
|
||||
|
||||
pytest -m "serial"
|
||||
|
||||
.. _contributing_using_fixtures:
|
||||
|
||||
Using fixtures
|
||||
--------------
|
||||
|
||||
To run Datasette itself, type ``datasette``.
|
||||
|
||||
You're going to need at least one SQLite database. A quick way to get started is to use the fixtures database that Datasette uses for its own tests.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue