runner report: Replace percentage with confidence interval in summary

As you run more repetitions of a test you get a better idea of how
reliable the test is.  A percentage is useful to describe a failure rate
independent of the number of runs but doesn't include information on how
reliable that percentage is likely to be.

This commit replaces the percentages in the report with percentage ranges
called "confidence intervals".  This means that instead of 43/430 being
a failure rate of 10% it will read 7.5% - 13%.  This means that there is
a 95% chance that the "true" reliability of the test falls between 7.5%
and 13% rather than the potentially misleading 10%.

We use the Wilson Score Interval[1] to calculate the confidence interval.
This assumes a binomial distribution (e.g. test pass/fail results are
independent of each other).

Possible future work:

* Include a further breakdown in the report summary by test exit status
  reason.
* Include a Chi-Squared Test[2] for comparing the results with different
  filters applied to answer questions like "has reliability improved
  between these two versions of software?".
* Write tutorial documentation to help users understand the statistics
  and how to interpret test results.

See also:

* Website for calculating confidence intervals[3]
* Evan Miller's excellent "Statistical Formulas For Programmers"[4]

[1]: http://en.wikipedia.org/wiki/Binomial_proportion_confidence_interval#Wilson_score_interval
[2]: http://www.evanmiller.org/ab-testing/chi-squared.html
[3]: http://vassarstats.net/prop1.html
[4]: http://www.evanmiller.org/statistical-formulas-for-programmers.html
runner report: Minor wording/spelling fixes, wrap lines
Merge branch 'report-confidence-interval'

Closes #76.

* report-confidence-interval:
  runner report: Minor wording/spelling fixes, wrap lines
  runner report: Replace percentage with confidence interval in summary
make check-pylint: Set PYTHONPATH for tests/fake-irnetbox

`fake-irnetbox` worked correctly when run from `run-tests.sh`, because
`run-tests.sh` sets PYTHONPATH correctly; now the `make check-pylint`
recipe also sets PYTHONPATH so that pylint can find the `irnetbox`
module used by `fake-irnetbox`.
extra/stb-tester.spec: Relax pylint < 1.0 requirement

We want people to be able to install the stb-tester RPM on systems like
Fedora 19 that have pylint 1.0. They just won't be able to use the new
`stbt lint` tool (due to bugs with pylint, and possibly differences in
the pylint plugin API; see 97eada33 and 65a38380). Note that `stbt lint`
checks the pylint version and exits with a clear error message.
Bump stb-tester version to 0.17

Note that the version number in the RPM spec file was already set to
0.17 (in 96afe36d; we haven't released the RPM since then so we don't
need to bump the version or release numbers).
runner/templates/testrun.html: list images before log files

In failure instances, the screenshot is what you want to see first to
diagnose a failure. When collecting additional log files (using the
runner.extra-logging hook) the number of logs can push the screenshot and
other image artifacts off the bottom of the page (meaning the user must
scroll down the page for each test run they investigate.

This change simply makes the image artifacts be listed before any logs.
extra/runner summary report: Improve confidence interval display

Instead of:

    Passed: 74/80 (85% - 97%). Failed: 6/80 (3.4% - 17%). Errors: 0/80 (0% - 4.6%).

We now show:

    Passed: 74/80 (91±6%). Failed: 6/80 (9.4±6%). Errors: 0/80 (<4.6%).

Which is much clearer.
extra/runner summary report: Fix display of 100% in confidence interval

This displays "100%" instead of "1.0e+2%".

Note that the original code (in the "else" branch) is correct; only the
edge cases for k=0 and k=n (that I introduced in 2c333020) were
incorrect.
extra/pylint.{sh,conf}: Cleanup: Move "ignored-classes" to config file

The ignored checkers/messages are specified in the config file, so the
ignored classes belong there too.
make check: Disable pylint checks on numpy members

It seems that pylint can't figure out some magic done by numpy 1.8.0,
so stbt.py would fail `make check` with:

    E1101:410,16:detect_motion: Module 'numpy' has no 'multiply' member
    E1101:411,20:detect_motion: Module 'numpy' has no 'ones' member
    E1101:411,50:detect_motion: Module 'numpy' has no 'uint8' member
    E1101:413,26:detect_motion: Module 'numpy' has no 'uint8' member
    E1101:1013,11:gst_to_opencv: Module 'numpy' has no 'ndarray' member
    E1101:1018,14:gst_to_opencv: Module 'numpy' has no 'uint8' member
    E1101:1096,9:_match_template: Module 'numpy' has no 'ones' member
    E1101:1096,59:_match_template: Module 'numpy' has no 'zeros' member
    E1101:1099,18:_match_template: Module 'numpy' has no 'float32' member
    E1101:1161,39:_match_template: Module 'numpy' has no 'uint8' member
    E1101:1277,22:_log_image: Module 'numpy' has no 'float32' member
    E1101:1988,24:_fake_frames_at_half_motion.FakeDisplay.frames: Module 'numpy' has no 'zeros' member
    E1101:1988,53:_fake_frames_at_half_motion.FakeDisplay.frames: Module 'numpy' has no 'uint8' member
    E1101:1989,24:_fake_frames_at_half_motion.FakeDisplay.frames: Module 'numpy' has no 'ones' member
    E1101:1989,52:_fake_frames_at_half_motion.FakeDisplay.frames: Module 'numpy' has no 'uint8' member

These are genuine numpy members (I tried them all in ipython).

Pylint 1.0.0 and 0.28.0 both fail to understand numpy 1.8.0. I didn't
have this problem with earlier versions of numpy (1.6.2, at least).
api-doc.sh: Raise error if command line argument is missing

api-doc.sh expects a command line argument that it passes to `cat`.

If no command line argument is specified, `cat` hangs the execution
waiting for standard input, while the user of the script may think that
documentation is being generated.
stbt.press: Ensure minimum delay between subsequent key presses

Our usual way of ensuring that remote control keys are pressed at
the right time is:

stbt.press(key1)
stbt.wait_for_match(template)
stbt.press(key2)

Due to the enhanced template match algorithm introduced in commit
ac97d6dd, wait_for_match might return so fast that some set-top-boxes
miss the second key press. According to our measurement results
these set-top-boxes require a certain minimum delay between subsequent
key presses in order to register every key.

This commit adds a new optional parameter `interpress_delay_secs` to
`stbt.press` that specifies a minimum time to wait after the preceding
key press that `stbt.press` ensures. The default value of this parameter
is read from the parameter of the same name in the `[press]` section of
the stbt config file.
tests for stbt.press interpress delay read config from tests/stbt.conf

The pattern used by all these tests is to use a `$STBT_CONFIG_FILE` (set
by `tests/run-tests.sh` to `tests/stbt.conf`) that contains the same
defaults as `tests/../stbt.conf`. This is necessary because
`$STBT_CONFIG_FILE` overrides the user's
`~/.config/stbt/stbt.conf` (which has configuration outside of our
control, that could break the tests).

This commit makes `test_that_press_waits_between_subsequent_presses` and
`test_that_press_reads_default_delay_from_stbt_conf` use the same
pattern used by all the other tests. Otherwise, the user's configuration
might have a "source_pipeline" that doesn't work, and thus causes
`stbt-run` to fail.
tests: Add test_that_press_doesnt_wait_any_longer_than_necessary
Merge branch 'interpress-delay'

* interpress-delay:
  tests: Add test_that_press_doesnt_wait_any_longer_than_necessary
  tests for stbt.press interpress delay read config from tests/stbt.conf
  stbt.press: Ensure minimum delay between subsequent key presses
Port to Gstreamer 1.0

Gstreamer 1.0 has been out for more than a year now and is where the
majority of the upstream development is going nowadays.  This change will
make it easier to develop further more advanced features such as sound
analysis and new UIs for stbt.

Using GStreamer 1.0 from Python is incompatible with Gstreamer 0.10 in
that Gstreamer 1.0:

1. Gstreamer 1.0 has a different C API to 0.10
2. Some of the elements and properties have been renamed in Gstreamer 1.0.
3. Gstreamer 1.0 uses GObject introspection for automatically generating
   Python bindings from the C API

This was mostly straightforward, but the changes to the appsink/appsrc
were quite tricky.  Because caps information is no longer attached to
buffers appsink now produces `GstSample`s rather than `GstBuffers` which
includes caps information.  Getting this right so the caps can get
through to the appsrc was a little tricky.  Also caps are now set as a
property on appsrc.

Notes:

* vp8enc has lost the "speed" property so this has been removed.  It
  should probably be replaced with the "cpu-used" property but I don't
  know what value should be used (range -16 - +16)
* sink pipeline used in tests now uses xvimagesink.  This needs testing
  on machines which don't have Xv support such as in a VM(?)
* gst_to_opencv now copies the data contained in the array.  It may be
  possible to further optimise this but that will require greater
  understanding on the relationship between Python and GObject lifetimes.
* on_new_sample is called as a GObject callback and should never throw.
  This was noticed as with Gstreamer 1.0 it requires a return value.  We
  should probably catch all exceptions thrown in any callback and work out
  how to signal errors some other way.
* pylint 0.25.1 which I have on my Debian testing machine doesn't
  understand gobject introspection imports so I've had to add a pylint
  disable to the import.  Upgrading to pylint 1.0.0 fixes this but finds
  other issues with the code.  This can be resolved in a seperate commit.
* I've had to increase the threshold in the black screen test as it seems,
  possibly with the move from video/x-raw-yuv to video/x-raw,format=I420
  that blacks aren't as black anymore, possibly as a result of GStreamer
  1.0 choosing a different type of yuv in 0.10.