<< All Blog Posts
5 Critical Considerations for Python Testing

5 Critical Considerations for Python Testing

Six Feet Up recently organized the IndyPy Pythology Lecture Series, where the focus was on testing and debugging Python applications. There were five presentations given with the goal of helping developers understand what it takes to properly test and debug code for the real world.

Here are five key points that were discussed during the event:

1. Continuous Integration

Travis CI logoCalvin Hendryx-Parker, CTO at Six Feet Up, gave the low down on the benefits of Continuous Integration and Travis CI.

Continuous Integration is a software development practice where members of a team commit their work frequently, leading to multiple integrations per day. Each integration is verified by an automated build (including test) to detect errors as quickly as possible. Many teams find that this approach leads to significantly reduced merge issues and allows a team to develop cohesive software more rapidly.
Continuous Integration (CI) is a critical aspect of building web applications. Before you get started, be sure you know:
  • The benefits of using CI
  • How to setup CI with a GitHub repository
  • How to automatically detect broken code
  • How to catch issues with old code before you start making changes

2. Load Testing

Rob McBroom, DevOps Engineer at Six Feet Up, spoke about performance testing with Locust.

Load testing is performed to determine a system's behavior under both normal and anticipated peak load conditions. Locust is an easy-to-use, distributed, user load testing tool intended for load testing web sites (or other systems) and figuring out how many concurrent users a system can handle.

Before you get started testing, it is essential to gain understanding of the benefits of using a performance testing tool like Locust.  While there are limitations, leveraging Locust will help you:

  • Set up a test on a defined list of URLs
  • Define user behavior with Python code
  • Simulate page views and interactions of millions of simultaneous users

For more, read Rob's blog post on Performance Testing with Locust.

3. Boundary Testing

Randy Syring, Chief Executive Developer of Level 12 gave a compelling talk about testing your application's boundaries.

  • How do you test if your application has sent an email reliably?
  • Should you setup an email server?
  • How about a third-party API, should you use their testing environment or try to monkey patch the socket connection?
  • How about databases? Do you use a real db server, mock objects, or fixtures for testing?
  • How do you prevent cross-test data contamination?
  • What about testing database migrations?

Any way you look at it testing the boundaries of email, database, and network services is critical to the successful deployment of your application.

4. Testing Frameworks

Wes Winham, VP of Product at PolicyStat gave a whirlwind tour of two Python testing frameworks.

pytest logo nose logo

Nose and pytest frameworks share a history and support powerful, no-boilerplate testing. Following the "batteries included" pythonic philosophy, they also support loads of use-them-when-you-need-them features and plugins. Some of the most powerful features of nose and pytest include:

  • Test generators
  • Powerful test selection
  • Debugging options
  • Rich plugin ecosystem

Leveraging these features will undoubtedly solve some testing problems commonly encountered in your real-world projects.

5. Methodology & Best Practices

Randy Syring also gave us a recap of testing methodology and best practices. In conclusion of our rehash of critical considerations for Python Testing, it is only fitting we note the methods and best practices for testing should not go unnoticed. By understand the foundation for testing we learn:

  • Ways to make team testing more effective
  • Test centric vs test driven development, and
  • How to get started testing when there are no tests and code is messy

Learn More

Watch video presentations of these discussions on YouTube.

Python developers are invited to attend the next IndyPy Pythology Lecture where we will be discussing Data Science with Python.

Want to learn more? Be sure to sign up for our Python How-To digest and get articles as soon as they are published!



Thanks for filling out the form! A Six Feet Up representative will be in contact with you soon.

Connect with us