SSTTestCase is run twice in python unittest testsuite?
It seems that SSTTestCase is executed twice when it's added in unittest testsuite.
I have a test:
from sst.actions import go_to, assert_
from sst import cases
class TestUbuntu(
def test_homepages(
go_to('http://
Which is added to following suite (testscenarios is used for multiple browser support in case of other browsers than Firefox):
import unittest
import xmlrunner
import testtools
from testscenarios import generate_scenarios
from sst import cases
from test_ubuntu import TestUbuntu
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
suite = unittest.
runner = xmlrunner.
mytests = unittest.
mytests.
for test in testtools.
suite.addTests(
runner.run(suite)
When the suite is being executed (python suite.py) the test is run twice. If I don't add the test to mytests, the test is executed once, but XML test result report is not being produced.
Is this a bug or feature? Should I be executing SSTTestCases only via SST-run?
Question information
- Language:
- English Edit question
- Status:
- Solved
- Assignee:
- No assignee Edit question
- Solved by:
- Ari
- Solved:
- 2013-08-27
- Last query:
- 2013-08-27
- Last reply:
- 2013-08-26
Ari (arzzka) said : | #1 |
SST version was 0.2.4.
Vincent Ladeuil (vila) said : | #2 |
SSTTestCase is meant to be used as a regular unittest test case, so it doesn't require sst-run.
I can't diagnose what went wrong in your case but I suspect it has to do with the way you build and run your test suite rather than sst itself.
Ari (arzzka) said : | #3 |
Even when I simplify the suite to be:
import unittest
import xmlrunner
from sst import cases
from test_ubuntu import TestUbuntu
from StringIO import StringIO
runner = xmlrunner.
loader = unittest.
suite = loader.
runner.run(suite)
The test is run twice.
Vincent Ladeuil (vila) said : | #4 |
What does suite.countTest
Which tests are present in suite._tests ?
Ari (arzzka) said : | #5 |
It starts to look like my Eclipse/Pydev run configuration is somehow screwed, because it does not happen from command line after all. Let me try once more tomorrow on a different machine.
print suite.countTest
print suite._tests
Console output from Eclipse:
Finding files... done.
Importing test modules ... 1
[<test_
done.
So number of tests is 1 and suite._tests has only one case. Firefox pops up 2 times in Eclipse, not via command line.
Ari (arzzka) said : | #6 |
Eclipse/Pydev run configs were messed up. This issue is solved.