tests/test-stbt-batch.sh: Increase timeouts

Self-tests that are testing that `stbt batch run` (without `-1`) keeps
on running until one of the test scripts fails, have a timeout to avoid
the self-test running forever in the (hypothetical) presence of a bug
in `stbt batch run`. This timeout needs to be increased for systems that
are running the self-tests while under heavy load. The increased timeout
shouldn't make any difference to the run-time of these self-tests in the
normal (successful) case.

Thanks to Lewis Haley for reporting the problem:

> I got false negatives for these tests because they were timing out
> before they could conclude. This was probably due to my system having
> a heavy load at the time (running tests with extra logging processes)
> and the stb-tester selftests in parallel.

I also did some related cleanup: I added the `-1` argument to a
self-test that isn't explicitly testing the exit-on-failure behaviour,
but was relying on the fact that `tests/test.py` returns failure the
second time it is run. And I added a timeout to all remaining self-tests
that call `stbt batch run` without `-1`, for consistency.
stbt control: Detect duplicated keyboard keys in the keymap file

If a user assigns multiple remote control keys to a keyboard key in the
keymap file, like

    o   OPEN
    o   OK

`stbt control` silently ignores this configuration issue and only
uses the mapping that is specified later in the keymap file.

Rase `stbt.ConfigurationError` if a keyboard key is duplicated.
Merge pull request #123 from szemate/stbt-control-to-detect-duplicated-key

stbt control: Detect duplicated keyboard keys in the keymap file
stbt.py: Document that GObject.threads_init() won't be needed forever

See
https://help.gnome.org/misc/release-notes/3.12/developers.html.en#pygobject

For the foreseeable future we still have to support GObject < 3.12.
stbt.py: Fix teardown hang with BlackMagic Intensity Pro

Since the port to GStreamer 1.0 the BlackMagic Intensity Pro has caused
an intermittant hang during pipeline teardown (after the test script has
run to completion).  While it should be valid to call

    source_pipeline.set_state(Gst.State.NULL)

at any time this was hanging.

It seems from the backtraces that the `GstBaseSrc` thread that was
associated with `decklinksrc` was blocked calling `gst_task_join`, e.g.
waiting for the BlackMagic thread to finish.  In turn there was another
thread (presumably the target of the join) calling into the proprietary
BlackMagic blob which seemed to be just blocked on `poll()`, presumably as
part of an event loop.  There must be some sort of race condition in there.

Instead we shut the pipeline down more gently by first sending EOS to the
source pipeline and then only after receiving EOS from our `appsink` do we
precede to state NULL.  This way we can be certain that the pipeline is
quiescent before attempting the state change.   This seems to fix the hang.

Fixes #110
Merge pull request #124 from wmanley/blackmagic-fixes

stbt.py: Fix teardown hang with BlackMagic Intensity Pro
fixup! stbt.py: Fix teardown hang with BlackMagic Intensity Pro

Fix a race in the recently modified teardown code.  With further testing
with the Teradek VidiU I got the error:

    stbt-run: teardown: Source pipeline did not teardown gracefully
    Traceback (most recent call last):

      File "stbt.py", line 1408, in teardown
        self.source_pipeline.set_state(Gst.State.NULL)
    AttributeError: 'NoneType' object has no attribute 'set_state'

As `rtmpsrc` has its own teardown problems (see #111).
Misc: Fix typo in error message

Instead of "usedwith" it says "used with".
stbt.py: Fix `stbt._set_config` for sections which don't yet exist

Bug discovered when trying to set a config item in an empty config file.