The existing use of unittest structures is antiquated, and modern Pythonic code uses pytest and tox. This PR introduces Tox and Pytest but does not (yet) integrate them into CI.
Brings in missing tests and makes them Python 3.x-compatible
Because the existing unittest code had some custom integrations, they did not properly run tests in subdirectories. When running with pytest, these test results became visible, and it became apparent that they were not compatible with Python 3. This PR fixes those compatibility issues.
Stricter .conf file syntax
The existing .conf files use inline comments. This is invalid because the .ini file format requires that comments and non-comments can't be defined on the same line. Python 2 was lenient in parsing these, but Python 3 is not. This PR makes all example .conf files valid.
Marks important tests as "smoke"
It's helpful to have a set of tests that covers essential functionality in a short amount of time. Tests that exercise the following have been marked as smoke using the pytest marking facility:
Authentication
Search
Modular Inputs
Search Command
Fixes minor issues in SearchCommands
The fixed Python 3 tests revealed minor issues in the SearchCommands module. Here's what's fixed:
Code validator would crash on invalid code due to accessing the .message property, which is unavailable in Python 3.
EventingCommand, GeneratingCommand, and StreamingCommand now properly appear as Python 3-style iterables. (This may change in the future, as the treatment of these commands as dict may be a bug.)
Adds a script to build a .splunkrc
You might be interested in building a .splunkrc from some kind of JSON structure that describes a Splunk deployment. A new script (in the new scripts directory) nicely produces that file.
This PR accomplishes the following.
Moves toward use of Tox and Pytest
The existing use of
unittest
structures is antiquated, and modern Pythonic code usespytest
andtox
. This PR introduces Tox and Pytest but does not (yet) integrate them into CI.Brings in missing tests and makes them Python 3.x-compatible
Because the existing
unittest
code had some custom integrations, they did not properly run tests in subdirectories. When running withpytest
, these test results became visible, and it became apparent that they were not compatible with Python 3. This PR fixes those compatibility issues.Stricter .conf file syntax
The existing
.conf
files use inline comments. This is invalid because the.ini
file format requires that comments and non-comments can't be defined on the same line. Python 2 was lenient in parsing these, but Python 3 is not. This PR makes all example.conf
files valid.Marks important tests as "smoke"
It's helpful to have a set of tests that covers essential functionality in a short amount of time. Tests that exercise the following have been marked as
smoke
using thepytest
marking facility:Fixes minor issues in SearchCommands
The fixed Python 3 tests revealed minor issues in the SearchCommands module. Here's what's fixed:
Code
validator would crash on invalid code due to accessing the.message
property, which is unavailable in Python 3.EventingCommand
,GeneratingCommand
, andStreamingCommand
now properly appear as Python 3-style iterables. (This may change in the future, as the treatment of these commands asdict
may be a bug.)Adds a script to build a .splunkrc
You might be interested in building a
.splunkrc
from some kind of JSON structure that describes a Splunk deployment. A new script (in the newscripts
directory) nicely produces that file.