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
The test suite uses Python's standard library and the built-in **unittest**
4
4
library. The Splunk Enterprise SDK for Python has been tested with Python v3.7
5
5
and v3.9.
6
6
7
-
To run the unit tests, open a command prompt in the **/splunk-sdk-python**
8
-
directory and enter:
7
+
TODO: info about using tox.
8
+
9
+
TODO: info about different types of tests (unit/integration/system) + need to setup docker for integration and system.
10
+
11
+
## Running tests
12
+
13
+
- running without -f will run on currently active python version
14
+
- Run unit tests on all python versions:
15
+
16
+
`tox -f unit`
17
+
18
+
- running all tests (unit, integration and system)
19
+
-`tox`
20
+
21
+
- running specific test
22
+
- running type of test on only one python version
23
+
-
9
24
10
-
python setup.py test
11
25
12
-
You can also run individual test files, which are located in
13
-
**/splunk-sdk-python/tests**. Each distinct area of the SDK is tested in a
14
-
single file. For example, roles are tested
15
-
in `test_role.py`. To run this test, open a command prompt in
16
-
the **/splunk-sdk-python/tests** subdirectory and enter:
17
26
18
-
python test_role.py
19
27
20
28
NOTE: Before running the test suite, make sure the instance of Splunk you
21
29
are testing against doesn't have new events being dumped continuously
@@ -28,23 +36,8 @@ with the free Splunk license.
28
36
29
37
## Code Coverage
30
38
31
-
Coverage.py is an excellent tool for measuring code coverage of Python programs.
32
-
33
-
To install it, use easy_install:
34
-
35
-
easy_install coverage
36
-
37
-
Or use pip:
38
-
39
-
pip install coverage
40
-
41
-
To generate a report of the code coverage of the unit test suite, open a command
42
-
prompt in the **/splunk-sdk-python** directory and enter:
43
-
44
-
python setup.py coverage
39
+
Code coverage is also provided with `pytest-cov` which uses `Coverage.py` under the hood. The code coverage stats are displayed at the end of each tox test run.
45
40
46
-
This command runs the entire test suite and writes an HTML coverage report to
47
-
the **/splunk-sdk-python/coverage_report** directory.
41
+
## Test reports
48
42
49
-
For more information about Coverage.py, see the author's website
0 commit comments