Hi all,

I would like to use some existing tool like py.test or nose to
run my tests, but I failed to do so.
The problem is as follow. I have tests:

### test_methods.py ###
def test_one():
    assert 1 == 1

def test_two():
    assert 1 == 1

#############

I have abstraction layer that keeps information
about this test, like method name.
It's simple JSON file.

Then I have the test runner:

### test_runner.py ###
def read_test_definition():
   """read the JSON file and returns dict with test details"""

def test_run():
   my_test_data = read_test_definition()
   import test_methods
   for testid in my_test_data:
       my_method = my_test_data[testid]
       # here the 'my_method' is equal 'test_one' or 'test_two', hope
it's clear..
       test_method = getattr(test_methods, my_method)
       test_method()

###########

This code works without py.test or nosetests. For example if I use print
instead of 'assert'.
Both py.test and nosetests failed to execute this correctly.
Or maybe they do execute it correctly, I just don't understand it..:)
They both report only single test was executed.
I would like to see test report for each method executed in 'for' loop.
Is it possible?

PS. Sorry for my ignorance, I just started to learn Python last week.

Thanks,
Thomas
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to