RFC 8: Move to pytest testing tool

Overview

This RFC describes the replacement of pycsw’s custom testing tools with pytest.

Pycsw’s current testing tool is not using any standard testing framework, nor Python’s unittest package. It has been developed specifically for pycsw. It is usable and provides effective testing for pycsw. However, it has a number of weak areas that make its usage a bit cumbersome. Specifically:

pytest is a mature, full-featured Python testing tool. It is widely used in the Python community. It is a robust tool, available for multiple Python versions and implementations. It is feature complete and also sports a number of extra plugins, allowing for a flexible usage.

Pytest can be used to replace pycsw’s own testing tool. Its usage will improve all of the aforementioned issues with the current tool:

In addition to the mentioned improvements, pytest brings some additional benefits:

Proposed Solution

Pytest will be added as an extra requirement for pycsw development. This should not be problematic, as pytest is easily installable using pip and it is available on all platforms targeted by pycsw.

The existing testing tool will be refactored in order to remove the custom test runner code, replacing it with the pytest test runner. No modification should be needed in the actual test suites, as they are mostly data files. The new testing framework will not remove any of the currently available features.

Pytest tests will be generated in a similar way to the current implementation:

Running of tests will be performed by using the py.test tool, which is available with pytest’s installation.

Implementation

Pytest provides flexible mechanisms for configuration and parametrization of tests:

Activating the feature

Since this RFC is about replacing the current testing tool with a new one, the new testing tool will active by default and becomes the only choice for running pycsw’s tests.

Files affected

Backwards Compatibility Issues

The proposed change is backwards incompatible because the whole testing infrastructure will be replaced. However, this change will not affect any user facing functionality. It is strictly oriented towards improving developer experience. Even if the existing test infrastructure will be refactored, the actual subjects under test will not change in any way. The same test requests, same test data and same test suites will continue to be used. As such, all tests will continue to pass, including CITE tests.

Recap of major new functionalities:

Internal Interface changes

TBD

Performance Implications

None

TBD

Restrictions

None

Documentation

Documentation will be updated as required.

Miscellaneous

Issue Tracking ID

https://github.com/geopython/pycsw/issues/428

Pull Request

Pull request has not been issued yet. Implementation is ongoing at:

https://github.com/ricardogsilva/pycsw/tree/issue#428

Voting History

TBD

Status

TBD