You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/contributing/contributions_api.rst
+27-15Lines changed: 27 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,21 +30,37 @@ repository and contribute changes back to the project master branch using pull r
30
30
Test code
31
31
=========
32
32
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:
34
34
35
35
* **Unit tests** (:file:`tests/unit`) — verify all code paths of the API.
36
36
* **Integration tests** (:file:`tests/sitl`) — verify real-world code, examples, and documentation as they would perform in a real environment.
37
37
* **Web client tests** (:file:`tests/web`) — specifically verify the Python library's capability to talk to `DroneKit Cloud <http://cloud.dronekit.io>`_.
38
38
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
+
39
46
Setting up local testing
40
47
------------------------
41
48
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.
43
50
44
51
* :ref:`dronekit_development_linux`
45
52
* :ref:`dronekit_development_windows`
46
53
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
48
64
49
65
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:
50
66
@@ -57,13 +73,7 @@ For several tests, you may be required to set an **environment variable**. In yo
57
73
Unit tests
58
74
----------
59
75
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.
67
77
68
78
DroneKit-Python unit tests are based on the `nose <https://nose.readthedocs.org/en/latest/>`_ test framework,
69
79
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:
75
85
76
86
.. code:: bash
77
87
78
-
nosetests tests/unit
88
+
nosetests dronekit.test.unit
79
89
80
90
81
91
@@ -118,14 +128,16 @@ Integrated tests use a custom test runner that is similar to *nosetests*. On any
118
128
.. code:: bash
119
129
120
130
cd dronekit-python
121
-
python -um tests.sitl
131
+
nosetests dronekit.test.sitl
122
132
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
0 commit comments