Skip to content

Commit 75e1d8b

Browse files
committed
Update with information on how to run tests and additional dependencies for tests
1 parent 99cce83 commit 75e1d8b

File tree

1 file changed

+27
-15
lines changed

1 file changed

+27
-15
lines changed

docs/contributing/contributions_api.rst

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,37 @@ repository and contribute changes back to the project master branch using pull r
3030
Test code
3131
=========
3232

33-
Test code should be used to verify new and changed functionality. There are three test suites in DroneKit-Python:
33+
There are three test suites in DroneKit-Python:
3434

3535
* **Unit tests** (:file:`tests/unit`) — verify all code paths of the API.
3636
* **Integration tests** (:file:`tests/sitl`) — verify real-world code, examples, and documentation as they would perform in a real environment.
3737
* **Web client tests** (:file:`tests/web`) — specifically verify the Python library's capability to talk to `DroneKit Cloud <http://cloud.dronekit.io>`_.
3838

39+
Test code should be used to verify new and changed functionality. New tests should:
40+
41+
#. Verify all code paths that code can take.
42+
#. Be concise and straightforward.
43+
#. Be documented.
44+
45+
3946
Setting up local testing
4047
------------------------
4148

42-
The links below provide information on how to set up a development environment on your development computer. Changes to DroneKit can then be tested locally.
49+
Follow the links below to set up a development environment on your Linux or Windows computer.
4350

4451
* :ref:`dronekit_development_linux`
4552
* :ref:`dronekit_development_windows`
4653

47-
Several of the test suites use `nose <https://nose.readthedocs.org/en/latest/>`_, a Python library for writing test scripts and a command line tool for running these. When setting up your dev environment, all test dependencies will have been installed (via :file:`requirements.txt`).
54+
The tests require additional pip modules, including `nose <https://nose.readthedocs.org/en/latest/>`_, a
55+
Python library and tool for writing and running test scripts. These can be installed separately using either of the commands below:
56+
57+
.. code:: bash
58+
59+
# Install just the additional requirements for tests
60+
pip install requests nose mock
61+
62+
# (or) Install all requirements for dronekit, tests, and building documentation
63+
pip install -r requirements.txt
4864
4965
For several tests, you may be required to set an **environment variable**. In your command line, you can set the name of a variable to equal a value using the following invocation, depending on your OS:
5066

@@ -57,13 +73,7 @@ For several tests, you may be required to set an **environment variable**. In yo
5773
Unit tests
5874
----------
5975

60-
All new features that are written should be created with accompanying unit tests.
61-
62-
A good unit tests should:
63-
64-
#. Verify all code paths that code can take.
65-
#. Be concise and straightforward.
66-
#. Be documented.
76+
All new features should be created with accompanying unit tests.
6777

6878
DroneKit-Python unit tests are based on the `nose <https://nose.readthedocs.org/en/latest/>`_ test framework,
6979
and use `mock <https://docs.python.org/dev/library/unittest.mock.html>`_ to simulate objects and APIs and
@@ -75,7 +85,7 @@ command on a terminal/prompt:
7585

7686
.. code:: bash
7787
78-
nosetests tests/unit
88+
nosetests dronekit.test.unit
7989
8090
8191
@@ -118,14 +128,16 @@ Integrated tests use a custom test runner that is similar to *nosetests*. On any
118128
.. code:: bash
119129
120130
cd dronekit-python
121-
python -um tests.sitl
131+
nosetests dronekit.test.sitl
122132
123-
You can choose to test specific files by passing them as arguments:
133+
You can choose to run a specific tests. The example below shows how to run
134+
**\dronekit-python\dronekit\test\sitl\test_12.py**.
124135

125136
.. code:: bash
126137
127-
python -um tests.sitl test_1.py test2_.py ...
128-
138+
nosetests dronekit.test.sitl.test_12
139+
140+
129141
Configuring the test environment
130142
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
131143

0 commit comments

Comments
 (0)