This lesson is still being designed and assembled (Pre-Alpha version)

Single-Day Intermediate Python for Astronomical Software Development: Testing

This course aims to teach a core set of established, intermediate-level software development skills and best practices for working as part of a team in a research environment using Python as an example programming language (see detailed learning objectives below). The core set of skills we teach is not a comprehensive set of all-encompassing skills, but a selective set of tried-and-tested collaborative development skills that forms a firm foundation for continuing on your learning journey.

A typical learner for this course may be someone who is working in a research environment, needing to write some code, has gained basic software development skills either by self-learning or attending, e.g., a novice Software Carpentry Python course. They have been applying those skills in their domain of work by writing code for some time, e.g. half a year or more. However, their software development-related projects are now becoming larger and are involving more researchers and other stakeholders (e.g. users), for example:

They now need intermediate software engineering skills to help them design more robust software code that goes beyond a few thrown-together proof-of-concept scripts, taking into consideration the lifecycle of software, writing software for stakeholders, team ethic and applying a process to understanding, designing, building, releasing, and maintaining software.

Target Audience

This course is for you if:

This course is not for you if:

Prerequisites

To attend this course you should meet the following criteria. You can also test your prerequisite knowledge by taking this short quiz.

Git

  • You are familiar with the concept of version control
  • You have experience configuring Git for the first time and creating a local repository
  • You have experience using Git to create and clone a repository and add/commit changes to it and to push to/pull from a remote repository
  • Optionally, you have experience comparing various versions of tracked files or ignoring specific files

Python

  • You have a basic knowledge of programming in Python (using variables, lists, conditional statements, functions and importing external libraries)
  • You have previously written Python scripts or iPython/Jupyter notebooks to accomplish tasks in your domain of work

Shell

  • You have experience using a command line interface, such as Bash, to navigate a UNIX-style file system and run commands with arguments
  • Optionally, you have experience redirecting inputs and outputs from a command

Learning Objectives for the Workshop

  • Set up and use a suitable development environment together with popular source code management infrastructure to develop software collaboratively
  • Use a test framework to automate the verification of correct behaviour of code, and employ parameterisation and continuous integration to scale and further automate your testing
  • Design robust, extensible software through the application of suitable programming paradigms and design techniques
  • Understand the code review process and employ it to improve the quality of code
  • Prepare and release your software for reuse by others
  • Manage software improvement from feedback through agile techniques

Setup

Please make sure that you have all the necessary software and accounts setup ahead of the workshop as described in the Setup section. Also check the list of common issues, fixes & tips if you experience any problems running any of the tools you installed - your issue may be solved there.

Schedule

Setup Download and setup software required for the course
00:00 Setting the Scene What are we teaching in this course?
What motivated the selection of topics covered in the course?
00:10 Section 1: Obtaining the Software Project and Preparing Virtual Environment What tools are needed for collaborative software development?
00:15 Introduction to Our Software Project How to obtain software project we will be working on?
What is the structure of our software project?
00:40 Virtual Environments For Software Development What are virtual environments in software development and why you should use them?
How can we manage Python virtual environments and external (third-party) libraries?
What IDEs can we use for more convenient code development?
01:00 Section 2: Ensuring Correctness of Software at Scale What should we do to ensure our code is correct?
01:05 Automatically Testing Software Does the code we develop work the way it should do?
Can we (and others) verify these assertions for themselves?
To what extent are we confident of the accuracy of results that appear in publications?
01:45 Scaling Up Unit Testing How can we make it easier to write lots of tests?
How can we know how much of our code is being tested?
02:00 Robust Software with Testing Approaches How can we make our programs more resilient to failure?
Can we use testing to speed up our work?
02:30 Section 3: Automatizing code quality checks How to set up automatic testing for all contributors of the project?
How to enforce coding style conventions?
How to estimate computational effectiveness of the software and find bottlenecks?
02:35 Continuous Integration for Automated Testing How can I automate the testing of my repository’s code in a way that scales well?
What can I do to make testing across multiple platforms easier?
03:00 Verifying Code Style Using Linters What tools can help with maintaining a consistent code style?
How can we automate code style checking?
03:20 Measuring time and computational resources required by the software What is software profiling?
What tools can we use to measure time and computational resources required by our software?
03:45 Wrap-up Looking back at what was covered and how different pieces fit together
Where are some advanced topics and further reading available?
04:00 Finish

The actual schedule may vary slightly depending on the topics and exercises chosen by the instructor.