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

How To Locally Unit Test Python 3 App Engine Application?

I have testbed setup locally to test python2.7 based app engine application. As part of the python3… Read more How To Locally Unit Test Python 3 App Engine Application?

Define A Pytest Fixture Providing Multiple Arguments To Test Function

With pytest, I can define a fixture like so: @pytest.fixture def foo(): return 'blah' … Read more Define A Pytest Fixture Providing Multiple Arguments To Test Function

How To Use Logging, Pytest Fixture And Capsys?

I am trying to unit-test some algorithm that uses logging library. I have a fixture that creates a … Read more How To Use Logging, Pytest Fixture And Capsys?

Where Do The Python Unit Tests Go?

If you're writing a library, or an app, where do the unit test files go? It's nice to sep… Read more Where Do The Python Unit Tests Go?

Double Parameterization

So I have a set of tests where I'd like to test multiple versions of a solution. Currently I ha… Read more Double Parameterization

Python Unittest: Reporting Exception As Failure

I want to check for an exception in Python unittest, with the following requirements: Needs to be … Read more Python Unittest: Reporting Exception As Failure

Py.test Passing Results Of One Test To Another

Currently I have test looking like this: @pytest.mark.parametrize('param', [1,2,3]) def tes… Read more Py.test Passing Results Of One Test To Another

How Do I Unit Test The Methods In A Method Object?

I've performed the 'Replace Method with Method Object' refactoring described by Beck. N… Read more How Do I Unit Test The Methods In A Method Object?

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

In Python, How To Do Unit Test On A Function Without Return Value?

I am a pythoner. At these days I am driving myself to do a more complete unit test on some core mod… Read more In Python, How To Do Unit Test On A Function Without Return Value?

Managing Logs/warnings In Python Extensions

TL;DR version: What do you use for configurable (and preferably captured) logging inside your C++ b… Read more Managing Logs/warnings In Python Extensions

How Does @mock.patch Know Which Parameter To Use For Each Mock Object?

Looking at this webpage: http://www.toptal.com/python/an-introduction-to-mocking-in-python -- The a… Read more How Does @mock.patch Know Which Parameter To Use For Each Mock Object?

How To Fail A Python Unittest In Setupclass?

I am doing some unittests with python and some pre-test checks in setUpClass. How can I throw a uni… Read more How To Fail A Python Unittest In Setupclass?

Unittest Unable To Import Class From Pickle (attributeerror: Can't Get Attribute...)

I need a unittest to load a previously saved class in a pickle. However, when I load the pickle in … Read more Unittest Unable To Import Class From Pickle (attributeerror: Can't Get Attribute...)

Typeerror: Can't Pickle Pycapsule Objects

I use dill to save ML model to file. When I run my tests with python -m unittest it works. But if I… Read more Typeerror: Can't Pickle Pycapsule Objects

Nose, Unittest.testcase And Metaclass: Auto-generated Test_* Methods Not Discovered

This is a follow-up question for unittest and metaclass: automatic test_* method generation: For th… Read more Nose, Unittest.testcase And Metaclass: Auto-generated Test_* Methods Not Discovered

Python Patch Object With A Side_effect

I'm trying to have a Mock object return certain values based on the input given. I looked up a … Read more Python Patch Object With A Side_effect

How Can I Mock Any Function Which Is Not Being Called Directly?

TL;DR How can I patch or mock 'any functions that are not being called/used directly'? Scen… Read more How Can I Mock Any Function Which Is Not Being Called Directly?

How Do We Ensure That The Calls In The Mock.call_args_list Contain Calls With Arguments At The Same State Of When The Mock Object Was Called?

from mock import Mock j = [] u = Mock() u(j) # At this point u.call_args_list == [call([])] print u… Read more How Do We Ensure That The Calls In The Mock.call_args_list Contain Calls With Arguments At The Same State Of When The Mock Object Was Called?

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?