Top "Python-unittest" questions

Python's standard library framework for testing.

How do I run all Python unit tests in a directory?

I have a directory that contains my Python unit tests. Each unit test module is of the form test_*.py. …

python unit-testing testing python-unittest
Running single test from unittest.TestCase via command line

In our team, we define most test cases like this: One "framework" class ourtcfw.py: import unittest class OurTcFw(unittest.…

python unit-testing python-unittest
Explain the "setUp" and "tearDown" Python methods used in test cases

Can anyone explain the use of Python's setUp and tearDown methods while writing test cases apart from that setUp is …

python unit-testing python-unittest
AttributeError: 'module' object has no attribute 'tests'

I'm running this command: python manage.py test project.apps.app1.tests and it causes this error: AttributeError: 'module' object …

python django python-2.7 python-unittest
Python Mocking a function from an imported module

I want to understand how to @patch a function from an imported module. This is where I am so far. …

python unit-testing python-unittest python-mock
Is there any way to check with Python unittest assert if an iterable is not empty?

After submitting queries to a service, I get a dictionary / a list back and I want to make sure it's …

python python-2.7 unit-testing assertions python-unittest
Disable individual Python unit tests temporarily

How can individual unit tests be temporarily disabled when using the unittest module in Python?

python python-unittest
How can I check if a checkbox is checked in Selenium Python Webdriver?

I'm searching a week how check if a checkbox is checked in selenium webdriver with python, but I find only …

python selenium-webdriver python-unittest
Python unittest: how to run only part of a test file?

I have a test file that contains tests taking quite a lot of time (they send calculations to a cluster …

python unit-testing python-unittest
Attempted relative import beyond toplevel package

Here is my folder structure: Mopy/ # no init.py ! bash/ __init__.py bash.py # <--- Edit: yep there is …

python python-2.7 python-import python-unittest relative-import