Category "python-unittest"

unittest jsut runs 1 out of 4 test cases

We have this assigment where i should run these four test cases with the help of unittest but when I run it with the command python test.py (name of the file) i

Testing in pandas library: Why is function style chosen over class based testing?

Why is functional style testing facilitating testing compared to class based testing? Is this just additional library specific functionality or are there any ge

Why can't dunder/magic methods be set in unittest.mock.Mock.configure_mock?

I was writing some unit test in python and needed to mock a very general collections.abc.Sized, so I set off creating a Mock with a __len__ method whose return

Python unit test cannot find module [duplicate]

I have a question about how to correctly import module in python unit test module. this is my directory structure project - | _ Libra

Mock patch specific instance of class

How to mock a specific instance of a class using patch? In my test file I have: @classmethod def setUpClass(cls): cls.instance_of_my_class = myClass() one

PyCharm: individually working tests, not finding a file when run in group

In my Python project, I have a set of unittests, that load some data from files in a data sub-directory. In PyCharm (Community 2019.3), running each of them in

How to mock an environment variable that is referenced in an imported module?

I have created a file containing environment variables and I am writing a test for this file. The file ("my_variables.py") looks like: import os if os.getenv("

Python3.6 error: ModuleNotFoundError: No module named 'src'

I know similar questions have been asked before... But I had a quick doubt... I have been following this link: https://www.python-course.eu/python3_packages.php

Unit Testing Django Model Save Function

I'm creating tests to check that a custom calibration model save function updates an asset record (foreign key) if it is the latest calibration record for the a

Simulate the click on a button in the PyQt5 QMessageBox widget, during unittest CI

Rather than a long speech, if we run the minimum example below: $ python3 Python 3.7.6 (default, Jan 30 2020, 09:44:41) [GCC 9.2.1 20190827 (Red Hat 9.2.1-1)]

Why cant unittest.TestCases see my py.test fixtures?

I'm trying to use py.test's fixtures with my unit tests, in conjunction with unittest. I've put several fixtures in a conftest.py file at the top level of the p

Insufficient output from unittest subTest elements under pytest

I'm interested in using unittest's subTest for looping through some very similar tests. I found that, when I run tests written in this way under pytest (or nos