Merge lp://qastaging/~coreygoldberg/selenium-simple-test/concurrent-tests1 into lp://qastaging/selenium-simple-test
Status: | Merged |
---|---|
Merged at revision: | 425 |
Proposed branch: | lp://qastaging/~coreygoldberg/selenium-simple-test/concurrent-tests1 |
Merge into: | lp://qastaging/selenium-simple-test |
Diff against target: |
787 lines (+577/-33) 11 files modified
docs/changelog.rst (+1/-0) docs/index.rst (+15/-17) requirements.txt (+1/-0) src/sst/cases.py (+1/-1) src/sst/command.py (+11/-10) src/sst/concurrency.py (+114/-0) src/sst/runtests.py (+15/-4) src/sst/scripts/run.py (+1/-0) src/sst/scripts/test.py (+1/-0) src/sst/tests/test_concurrency.py (+416/-0) tox-acceptance.ini (+1/-1) |
To merge this branch: | bzr merge lp://qastaging/~coreygoldberg/selenium-simple-test/concurrent-tests1 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Corey Goldberg (community) | Needs Resubmitting | ||
Vincent Ladeuil (community) | Needs Fixing | ||
Review via email:
|
Description of the change
Concurrency
----
wired up concurrency using concepts and code from bzrlib.
added new module: sst.concurrency
and tests: src/sst/
`--concurrency=N` command line arg will fork N workers for running test cases. Results are streamed and aggregated via subunit.
--concurrency is for Unix only (relies on os.fork())
new forking mechanism is *not* used when N=1 (default).. only when level is set an integer (number of processes to fork).
notes:
You can parallelize a test run across a configurable number of worker
processes. While this can speed up CPU-bound test runs, it is mainly
useful for IO-bound tests that spend most of their time waiting for
data to arrive from someplace else and can benefit from parallelization.
----
includes new dependency: 'python-subunit'
----
updated docs with concurrency parameter.
30 + parser. add_option( '--concurrency' , dest='use_ concurrency' , 'store_ true',
31 + default=False, action=
32 + help='concurrency enabled (proc per cpu):')
I think we want an integer rather than a boolean here, there are far too
many cases where using as many processes as processors doesn't match the
needs (sometimes you want to use more processes than processors, sometimes
you want to you less).
41 +# simple- test) /launchpad. net/selenium- simple- test
42 +# Copyright (c) 2013 Canonical Ltd.
43 +#
44 +# This file is part of: SST (selenium-
45 +# https:/
That's not the usual header is it ? Any reason to use a different one ?
126 +def iter_suite_ tests(suite) :
This flatten the test suite for no good reason, sst.filters. filter_ suite
should be re-usable here.
154 +class SubUnitSSTProto colClient( TestProtocolCli ent):
155 + def addSuccess(self, test, details=None):
156 + # The subunit client always includes the details in the subunit
157 + # stream, but we don't want to include it in ours.
Why don't we want to include it ? I can think of at least one case where it
can help: comparing a passing test with a failing one. As such, as a dev, I
would be pretty upset to have my carefully collected data thrown away ;)
170 +import Queue
173 +import threading
Doesn't pep8 warn you about this unused imports ?
260 +import sst.concurrency
261 +import sst.result
262 +import sst.tests
from sst import (... ?
295 + self.addCleanup (self.restore_ stdout) stdout( self):
296 +
297 + def restore_
298 + sys.stdout = sys.__stdout__
It's weird to see a restore function without anything changing sys.stdout...
384 +class ConcurrencyTest Case(TestCase) :
There is a lot of duplication there that makes it hard to review the
differences between the tests.
That seems to be a good start to test the happy paths though, I'm not sure
it's worth checking all the kinds of test ouputs (unless they were test
parameters which would make the parametrized test clearer).
486 + def test_concurrent _one_case_ per_threaded_ worker( self):
That one is definetely too big, I can't see what it is about and even wonder
what it really test. You may want to split it into different tests ?
Is it another attempt to use threads to run the tests ?
So overall, that seems like a good first step to implement concurrency via
fork but we really want tests for the error paths, including (not
exhaustive): one test failing, one test erroring, one test hanging, one
process dying and also interrupting the whole test run and ensure we get
some meaningful result in that case (these are the most common use cases I
can think of).