Skip to content

update Python testing section #220

@egpbos

Description

@egpbos

The Python testing section imho can be trimmed a bit and needs to be updated. The current section reads:

## Testing

* [pytest](https://docs.pytest.org/) is a full featured Python
testing tool. You can use it with `unittest`.
[Pytest intro](http://pythontesting.net/framework/pytest/pytest-introduction/)
* [Using mocks in Python](http://www.drdobbs.com/testing/using-mocks-in-python/240168251)
* [unittest](https://docs.python.org/3/library/unittest.html) is a
framework available in Python Standard Library.
[Dr.Dobb's on Unit Testing with Python](http://www.drdobbs.com/testing/unit-testing-with-python/240165163)
* [doctest](https://docs.python.org/3/library/doctest.html) searches for pieces of text that look like interactive Python sessions, and then executes those sessions to verify that they work exactly as shown. Always use this if you have example code in your documentation to make sure your examples actually work.

Using `pytest` is preferred over `unittest`, `pytest` has a much more concise syntax and supports many useful features.

Please make sure the command `python setup.py test` can be used to run your tests. When using `pytest`, this can be easily configured as described in the [`pytest` documentation](https://docs.pytest.org/en/latest/goodpractices.html#integrating-with-setuptools-python-setup-py-test-pytest-runner).

I would suggest removing unittest altogether, since we recommend pytest. We don't need to list all alternatives.

The bottom paragraph should be removed altogether, since the test command in setuptools has been deprecated: pypa/setuptools#1878 pytest-dev/pytest#5534

Any objections, additions or other thoughts? If not, I'll make a PR or if someone else wants to do it, by all means :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions