Skip to content Skip to sidebar Skip to footer
Showing posts with the label Unit Testing

Django Test Suite Url Coverage

I'd like to make sure that my Django test suite covers all URLs listed in my URL configuration.… Read more Django Test Suite Url Coverage

How To Run The Same Test-case For Different Classes?

I have several classes that share some invariants and have a common interface, and I would like to … Read more How To Run The Same Test-case For Different Classes?

Run Python Unit Test With Python 2.7 And 3.x

I run my python unit tests by executing my test file through the shell and invoking if __name__ == … Read more Run Python Unit Test With Python 2.7 And 3.x

Mocked Unit Test Raises A "stop Called On Unstarted Patcher" Error

When running the test bellow, I got a stop called on unstarted patcher. def test_get_subvention_int… Read more Mocked Unit Test Raises A "stop Called On Unstarted Patcher" Error

How To Unit Test 'mkdir' Function Without File System Access?

I use py.test for unit testing. I have something just like this: Class Site(object): def set_p… Read more How To Unit Test 'mkdir' Function Without File System Access?

Mocking Python Class In Unit Test And Verifying An Instance

I'm trying to unit test an SFTP helper class that makes some calls to the pysftp module. I want… Read more Mocking Python Class In Unit Test And Verifying An Instance

Pytest : Cannot Mock __init__ Of My Class

I am having a custom Db class, which has the basic operations. I am trying to write tests around it… Read more Pytest : Cannot Mock __init__ Of My Class

How To Properly Use Coverage.py In Python?

I've just started using Coverage.py module and so decided to make a simple test to check how it… Read more How To Properly Use Coverage.py In Python?

Mock Builtin 'open" Function When Used In Contextlib

I know this question has been asked before, but I have a particular problem, meaning I want the moc… Read more Mock Builtin 'open" Function When Used In Contextlib

Python Import Error - Run Unittest

Why am I getting import error for a module I have in the project. All the packages are under the pr… Read more Python Import Error - Run Unittest

Nosetest And Unittest.expectedfailures

I am currently testing my website with Selenium, Python and nosetests. Everything works fine for su… Read more Nosetest And Unittest.expectedfailures

How Can I Make Python's Coverage Tool Fail If Any Unit Tests Fail?

I want to use a shell script to make sure that my unit tests pass and that my code has sufficient t… Read more How Can I Make Python's Coverage Tool Fail If Any Unit Tests Fail?

Mocking Default=timezone.now For Unit Tests

I'm trying to write unit tests for a django app that does a lot of datetime operations. I have… Read more Mocking Default=timezone.now For Unit Tests

Django Unittest: Typeerror: 'nonetype' Object Is Not Iterable

python3 manage.py test apps.favorites Traceback (most recent call last): File 'manage.py'… Read more Django Unittest: Typeerror: 'nonetype' Object Is Not Iterable

How Should I Verify A Log Message When Testing Python Code Under Nose?

I'm trying to write a simple unit test that will verify that, under a certain condition, a clas… Read more How Should I Verify A Log Message When Testing Python Code Under Nose?

Comparing Numpy Float Arrays In Unit Tests

What is the best way to implement a unittest that compares two numpy float arrays. I've tried u… Read more Comparing Numpy Float Arrays In Unit Tests

How To Mock Just The Method Inside The Class

Trying to write a testcase for my class based function. This is skeleton of my class class Library(… Read more How To Mock Just The Method Inside The Class

How To Unit Test Methods Inside Django's Class Based Views?

I need to test the methods and helper function inside a django Class Based View. Consider this Clas… Read more How To Unit Test Methods Inside Django's Class Based Views?

Extract Hash Seed In Unit Testing

I need to get the random hash seed used by python to replicate failing unittests. If PYTHONHASHSEED… Read more Extract Hash Seed In Unit Testing

Test Django Views That Require Login Using Requestfactory

I'm new to Django and I'd like to unit test a view that requires the user to be logged in (… Read more Test Django Views That Require Login Using Requestfactory