splunk / splunk-sdk-python

Splunk Software Development Kit for Python
http://dev.splunk.com
Apache License 2.0
687 stars 369 forks source link

Smoke tests #314

Closed amysutedja closed 4 years ago

amysutedja commented 4 years ago

This PR accomplishes the following.

Moves toward use of Tox and Pytest

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:

Fixes minor issues in SearchCommands

The fixed Python 3 tests revealed minor issues in the SearchCommands module. Here's what's fixed:

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.