pyunit

Make pyunit show output for every assertion

How can I make python's unittest module show output for every assertion, rather than failing at the first one per test case? It would be much easier to debug if I could see the complete pattern of failures rather than just the first one. In my case the assertions are based on a couple loops over an array containing an object plus some f...

nice html reports for pyunit

Do you know a tool for creating nice html reports for pyunit? ...

Python unittest: how to run only part of a test file ?

Hi, I have a test file that contains tests taking quite a lot of time (they send calculations to a cluster and wait for the result). All of these are in specific TestCase class. Since they take time and furthermore are not likely to break, I'd want to be able to choose whether this subset of tests does or doesn't run (the best way woul...

using pyunit on a network thread

I am tasked with writing unit tests for a suite of networked software written in python. Writing units for message builders and other static methods is very simple, but I've hit a wall when it comes to writing a tests for network looped threads. For example: The server it connects to could be on any port, and I want to be able to test t...

How to extend and modify PyUnit

I'm about to embark upon extending and modifying PyUnit. For instance, I will add warnings to it, in addition to failures. I'm interested in hearing words of advice on how to start, for instance, subclass every PyUnit class? What to avoid and misc caveats. Looking for input from those that have extended PyUnit already. ...

Generate test coverage information from pyunit unittests?

I have some pyunit unit tests for a simple command line programme I'm writing. Is it possible for me to generate test coverage numbers? I want to see what lines aren't being covered by my tests. ...

Running Tests From a Module

I am attempting to run some unit tests in python from what I believe is a module. I have a directory structure like TestSuite.py UnitTests |__init__.py |TestConvertStringToNumber.py In testsuite.py I have import unittest import UnitTests class TestSuite: def __init__(self): pass print "Starting testting" suite = unit...

Test framework for component testing

I am looking for a test framework that suit my requirements. Following are the steps that I need to perform during automated testing: SetUp (There are some input files, that needs to be read or copied into some specific folders.) Execute (Run the stand alone) Tear Down (Clean up to bring the system in its old state) Apart from this I...

What is the keyboard shortcut to run all unit tests in the current project in PyDev + Eclipse?

I know Ctrl + F9 runs a single file. How to run them all? If there is no such thing, how to bind one keyboard shortcut to it? ...

Testing python methods that call class methods

I have a very simple method: Class Team(models.Model): def sides(self): return SideNames.objects.filter(team=self) SideNames is another model defined in the same file as Team, Which when I try and test: self.assertEquals(len(t.sides()), 2) I get the following error: return SideNames.objects.filter(team=self) Att...

How to make my Python unit tests to import the tested modules if they are in sister folders?

I am still getting my head around the import statement. If I have 2 folders in the same level: src test How to make the py files in test import the modules in src? Is there a better solution (like put a folder inside another?) ...

Pyunit: "Import Site"

Using pyUnit to do what is currently a very small and simple unit test I am getting the message: 'import site' failed; use -v for traceback ... ____________________________________________ Ran 3 tests in 0.094S When I rerun the unit test with the -v parameter, it returns verbose information about each of the 3 tests and has no error o...

Testing Python Decorators?

I'm writing some unit tests for a Django project, and I was wondering if its possible (or necessary?) to test some of the decorators that I wrote for it. Here is an example of a decorator that I wrote: class login_required(object): def __init__(self, f): self.f = f def __call__(self, *args): request = args[0...

Is test suite deprecated in PyUnit?

Following the example in PyUnit, I came up with the following unittest code that works fine. import unittest class Board: def __init__(self, x, y): self.x = x; self.y = y; def __eq__(self, other): return self.x == other.x and self.y == other.y class BoardTest(unittest.TestCase): def setUp(self): self.b10_10 ...

PyUnit with a variable number of tests

What I would like to do, is create a folder, where people can put in a file for testing, and have pyunit automatically expand in order to run the test as a separate test. Currently, what I'm doing is: class TestName(unittest.testcase): def setUp(self): for file in os.listdir(DIRECTORY): # Setup Tests def te...

Python Unittest

I am using python unittest module to do a number of tests; however, it is very repetitive. I have a lot of data that I want to run through the same test over and over, checking if correct. However, I have to define a test for every one. For instance I want to do something similar to this. I know I could do it using a generator (found ...

Calling a Selenium Testcase in python

I'm trying to run a selenium testcase in python. I have testcases that I can run directly from the command line no problem with python seleniumtest.py However when I try to run it from within python it is failing. __import__('seleniumtest') seleniumtest.py ends with a command unittest.main() this command seems to fail when it...