This last episode of ByteSized RSE before the end of 2022 is about testing your Python code.
Testing is an essential part of software development, and a lot of what we cover in this episode applies to any programming and scripting language.
For Python, the two big frameworks being used are unittest and PyTest. Unittest is built into Python, whereas PyTest is a module you would need to install extra.
- https://docs.python.org/3/library/unittest.html the built in unit testing framework of Python
- https://docs.python.org/3/library/unittest.mock.html mock testing in the unittest framework
- https://docs.python.org/3/library/unittest.html#class-and-module-fixtures fixtures for classes and modules
- https://docs.pytest.org/en/7.2.x/ the popular PyTest framework
- Mocking can be done with monkeypatch in PyTest https://docs.pytest.org/en/7.1.x/how-to/monkeypatch.html#
- Fixtures in PyTest: https://docs.pytest.org/en/7.2.x/reference/fixtures.html
Books mentioned
- Working effectively with legacy code, Michael Feathers, ISBN: 9780131177055, Pearson's, 2004
- Refactoring: Improving the Design of Existing Code, Martin Fowler, ISBN: 9780134757681, 2nd edition, Addison-Wesley Professional
Byte-sized RSE is presented in collaboration with the UNIVERSE-HPC project.
https://www.imperial.ac.uk/computational-methods/rse/events/byte-sized-rse/ ByteSized RSE link to Imperial College
Thank you for listening and your ongoing support. It means the world to us!
You can also support our efforts by leaving a rating or review.
Follow or contact us on
- Email mailto:code4thought@proton.me
- Patreon https://www.patreon.com/codeforthought
- Slack (ukrse.slack.com): @code4thought
- Mastadon: @code4thought@fosstodon.org
- LinkedIn: https://www.linkedin.com/in/pweschmidt/
This podcast is licensed under the Creative Commons Licence: https://creativecommons.org/licenses/by-sa/4.0/