Skip to Main Content
Hands-On Application Development with PyCharm
book

Hands-On Application Development with PyCharm

by Quan Nguyen
September 2019
Beginner to intermediate content levelBeginner to intermediate
494 pages
13h
English
Packt Publishing
Content preview from Hands-On Application Development with PyCharm

Creating unit tests with PyCharm

We have talked about various features when it comes to examining the results from previously created unit tests in PyCharm. However, the support for testing from PyCharm does not stop there, and in this section, we will learn how to create unit tests within PyCharm.

In the same folder that we have been working with, Chapter06/Testing, open the counter.py file, which contains the following code:

import threadingimport sys; sys.setswitchinterval(.000001)class Counter:    def __init__(self, target, num_threads):        self.value = 0        self.target = target        self.num_threads = num_threads    def update(self):        current_value = self.value        self.value = current_value + 1    def run(self): threads = [threading.Thread(target=self.update) ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

MASTERING PYCHARM

MASTERING PYCHARM

Nafiul Islam

Publisher Resources

ISBN: 9781789348262Supplemental Content