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

How To Use A Command Line Argument In Unittest?

For some reason I'm having issues trying to use command line arguments with my unittests. Simpl… Read more How To Use A Command Line Argument In Unittest?

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

How Do I Test That I'm Calling Pickle.dump() Correctly?

I want to test this method: class Data(object): def save(self, filename=''): i… Read more How Do I Test That I'm Calling Pickle.dump() Correctly?

Mock Exception With Side Effect Raised In Class Method And Caught In Calling Method Gives 'did Not Raise'

Using side_effect, I am trying to raise an exception when a mock is called but I get a DID NOT RAIS… Read more Mock Exception With Side Effect Raised In Class Method And Caught In Calling Method Gives 'did Not Raise'

How To Force Tests To Stop Running A Test Suite After A Specified Test Failed?

I have a test suite written in Selenium Webdriver/Python 2.7 consisting of several test cases. Some… Read more How To Force Tests To Stop Running A Test Suite After A Specified Test Failed?

Scrapy: Effective Way To Test Inline Requests

I wrote a spider using scrapy-inline-requests library. So the parse method in my spider looks somet… Read more Scrapy: Effective Way To Test Inline Requests

Django Unittests Client Login: Fails In Test Suite, But Not In Shell

I'm running a basic test of my home view. While logging the client in from the shell works, the… Read more Django Unittests Client Login: Fails In Test Suite, But Not In Shell

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?

Mocking External Api For Testing With Python

Context I am trying to write tests for functions that query an external API. These functions send r… Read more Mocking External Api For Testing With Python

Automating Unit Testing In Pyqt5 Using Gitlab's Ci: Qxcbconnection Error

I am creating a GUI skeleton (for now) using PyQt5 and I have written some unit tests (using Python… Read more Automating Unit Testing In Pyqt5 Using Gitlab's Ci: Qxcbconnection Error

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

How To Mock A Redis Client In Python?

I just found that a bunch of unit tests are failing, due a developer hasn't mocked out the depe… Read more How To Mock A Redis Client In Python?

Actually Testing My Constructed Application (flask, Python)

If I have an application built, what is the protocol for testing the actual application? I'm j… Read more Actually Testing My Constructed Application (flask, Python)

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

(unit) Test Python Signal Handler

I have a simple Python service, where there is a loop that performs some action infinitely. On vari… Read more (unit) Test Python Signal Handler

Is There A Way For A Python Nose Test To Know Its Decorated Attributes?

I have some tests like: @attr('sanity', 'someothertag') def test_this_important_fea… Read more Is There A Way For A Python Nose Test To Know Its Decorated Attributes?

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?

Which Is The Better Way To Pass Data Into Python Unittest Redirected Stdin Or Pickle?

Short Question What is the best way to get data into a Python unittest case ? Background My project… Read more Which Is The Better Way To Pass Data Into Python Unittest Redirected Stdin Or Pickle?

Python Mock Not Asserting Calls

I'm using the mock library to patch a class in a program that connects to a external resource a… Read more Python Mock Not Asserting Calls

Testing Python Scripts

How do I test the STDOUT output of a Python script with a testing framework like doctest, unittest,… Read more Testing Python Scripts