Skip to content

Commit

Permalink
Update development docs to utilize pytest instead of old and deprecated
Browse files Browse the repository at this point in the history
setup.py test command.
  • Loading branch information
Kami committed Aug 3, 2023
1 parent fe4772c commit 6e0a42c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
14 changes: 11 additions & 3 deletions docs/testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ dependencies installed:

* ``tox`` (``pip install tox``) - you only need this library if you want to
use tox to run the tests with all the supported Python versions
* ``pytest`` (``pip install pytest``) - test runner we use to run the tests
* ``fasteners`` (``pip install fasteners``) - only used in the local storage
driver
* ``coverage`` (``pip install coverage``) - you only need this library if you
Expand Down Expand Up @@ -44,7 +45,7 @@ following command:

.. sourcecode:: bash

PYTHONPATH=. python setup.py test
pytest -s -vvv

Running a Single Test File
--------------------------
Expand All @@ -54,13 +55,20 @@ repository and run the following command:

.. sourcecode:: bash

PYTHONPATH=. python libcloud/test/<path to test file>
pytest -s -vvv libcloud/test/<path to test file>

For example:

.. sourcecode:: bash

PYTHONPATH=. python libcloud/test/compute/test_ec2.py
pytest -s -vvv libcloud/test/compute/test_ec2.py

You can also run single test in a test file by using ``-k`` flag as shown
below:

.. sourcecode:: bash

pytest -s -vvv libcloud/test/compute/test_ec2.py -k "test_list_nodes"

Generating Test Coverage Report
-------------------------------
Expand Down
1 change: 0 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ setenv =
# NOTE: By default we run tests on CI in parallel to speed up the build
# To avoid per-test function process safety issues we run all tests in a single
# file in the same worker process.
# python setup.py test
# for pytest-xdist, we want to distribute tests by file aka --dist loadfile
commands = cp libcloud/test/secrets.py-dist libcloud/test/secrets.py
pytest --color=yes -rsx -vvv --capture=tee-sys -o log_cli=True --durations=10 --timeout=15 -n auto --dist loadfile --ignore libcloud/test/benchmarks/ --ignore-glob "*test_list_objects_filtering_performance*"
Expand Down

0 comments on commit 6e0a42c

Please sign in to comment.