#  Testing Python code with pytest 

 



####  calendar\_today Date and Time 

 **September 19, 2022** 

 01:00PM - 02:30PM EDT 

####  pin\_drop Location 

 **Virtual, Zoom**  



 

 [ Please register here! arrow\_circle\_right ](https://smithsonian.zoom.us/meeting/register/tZMkcemspzojGt1RyskgupWw-0NdxehcEvey) 

 



 

 Presented by Nick Murphy

 [Please register here!](https://smithsonian.zoom.us/meeting/register/tZMkcemspzojGt1RyskgupWw-0NdxehcEvey)

Software tests give us confidence that our code is working correctly. Tests help us find and fix bugs, preferably as soon as we introduce them. When working with code that is well-tested, we are able to change the code with confidence that we are not introducing hidden bugs elsewhere in the program. Software tests reduce frustration and make our lives easier. Even though tests are considered vital in software engineering, testing has been applied irregularly to scientific software. This tutorial will introduce how to write and run Python tests using [pytest](https://docs.pytest.org/en/7.1.x/). We will cover assertions, exceptions, how to write unit tests, how to run tests with pytest, test parameterization, and test-driven development. We will end with a discussion on software testing best practices, how to decide on what tests to write, and how to write code that is easy to test.

 

 



 

 

 Share on:- [     Facebook ](#)
- [     Twitter ](#)
- [     Linkedin ](#)
 


 Save: [ Add to calendar calendar\_today ](https://library.cfa.harvard.edu/node/1652169/event-feed.ics)  Copy link link