Speaker
Description
This tutorial will provide a hands-on introduction to automating unit testing in Python using the industry-standard pytest framework. Participants will learn how to design software components that are easily testable, write effective unit tests using pytest to ensure software robustness and maintainability, and generate and utilize code coverage metrics to verify the comprehensiveness of their test suite. The session will emphasize how these practices contribute to a more reliable software stack that enables reproducible research.
List of what participants will need:
- Wifi capable laptop in any operating system that can run python 3. Exercises are tested on MacOS and Linux.
- Code exercise repository: https://github.com/Smithsonian/adass2025-tutorial-pytest
- Python3 and pre-installed python packages (listed in code repository)
Instructions to Participants
1. Please setup your wifi capable laptop that can run Python 3 and has git version control installed which you must bring to the session.
a. Install anaconda https://conda-forge.org/download/
b. git clone https://github.com/Smithsonian/adass2025-tutorial-pytest.git
c. cd adass2025-tutorial-pytest
d. conda env create -n adasstest -f environment.yml
e. conda activate adasstest
f. python -c “print(‘hello world’)” # Must type out, do not copy paste because quote marks will be wrong.
If you see 'hello world', you are good to go.
If you do not, feel free to email gregory.ciccarelli@cfa.harvard.edu with the error message.
| Affiliation of the submitter | Smithsonian Astrophysical Observatory |
|---|---|
| Attendance | remote |