We're sorry but this page doesn't work properly without JavaScript enabled. Please enable it to continue.
Feedback

Testing your Plone codebase with Pytest

Formal Metadata

Title
Testing your Plone codebase with Pytest
Title of Series
Number of Parts
36
Author
License
CC Attribution 3.0 Germany:
You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal purpose as long as the work is attributed to the author in the manner specified by the author or licensor.
Identifiers
Publisher
Release Date
Language

Content Metadata

Subject Area
Genre
Abstract
Plone 6 is out, and now you create your new CMS project with a cookiecutter template, install it with pip, format the code with black, and deploy it with Docker. But you probably still test it as you did 10 or 15 years ago. Learn how to use Pytest with Plone, and make TDD fun again. Over the last few years, the Plone community has been busy working on making Plone development more accessible to new developers with the adoption of well-known tools over homegrown solutions: The default installation of Plone is now based on pip, the recommended way to deploy is using containers, and if you want to bootstrap a new project, there is a cookiecutter template to do it. On the other hand, we still rely on the same patterns and snippets when testing the Python code of a Plone solution: Layers and test cases of Unittest, but there should be a better (more pythonic) way. Moving your tests from Unittest to Pytest is easy, and you gain access to all the features of the most comprehensive testing framework in the Python world. In this talk, we will present the reasoning for choosing Pytest over Unittest, but also show how your tests will be easier to write and maintain.