test_detect_match_nonexistent_template: Cleanup unused import

Thanks to Lewis Haley for spotting this.
test_that_stbt_batch_*: Increase timeouts

These two tests fail intermittently on Travis CI, possibly because we
increased the number of tests that run in parallel in b46b3939.
_numpy_from_sample: Improve error reporting

Print a more useful message when wrong type passed to `_numpy_from_sample`.

I ran into this when mistakenly passing a region as the first argument to
`stbt.ocr`.
stbt._set_config: Don't fail if ~/.config/stbt/ doesn't exist

This happens if the user hasn't created `~/.config/stbt/` and hasn't
specified `$STBT_CONFIG_FILE`.
Makefile: Don't use parallel "--no-notice"

Because it isn't available in all versions of GNU parallel (thanks to
Lewis Haley for the heads-up).

I had introduced this in e3aa9fd to avoid verbose output on Travis CI,
so I'll place the workaround in the Travis setup instead.
Merge pull request #189 from drothlis/travis-silence-parallel-citation-notice

Makefile: Don't use parallel "--no-notice"
stbt._find_tessdata_dir: add tessdata directory suffix for Fedora

As tested on Fedora 17, 19 and 20, the `tessdata` directory is
`/usr/share/tesseract/tessdata`, which wasn't being found by
`_find_tessdata_dir`. This commit adds the valid suffix so that, among
other things, the selftests which require this function works.
stbt.py: [pylint] E713 test for membership should be 'not in'

This is bad (apparently):
`not elem in iter`

And this is good:
`elem not in iter`

According to pylint --version
  pylint 1.1.0,
  astroid 1.0.1, common 0.61.0
  Python 2.7.5 (default, Feb 19 2014, 13:47:28)
  [GCC 4.8.2 20131212 (Red Hat 4.8.2-7)]
stbt.py, irnetbox.py: [pylint] E265 block comment should start with '# '

I think we can all agree that this is much better.

According to pylint --version
  pylint 1.1.0,
  astroid 1.0.1, common 0.61.0
  Python 2.7.5 (default, Feb 19 2014, 13:47:28)
  [GCC 4.8.2 20131212 (Red Hat 4.8.2-7)]
stbt.temporary_x_session: use correct check that process has exited

An object returned by Popen can be checked if it is still running, etc.
However the existing check of looking at the `returncode` attribute would
*always* return `None` because it is only *set* when calling `poll` or
`wait`. [1][2]

This commit changes the check for the value returned by `poll`, which is
None if the command has not exited, other the returncode.

This test is failing on my PC because the original command is failing
from the outset, i.e. the x-server is *not* being launched at all.
Without this commit, the test hangs.

[1] Example:
In [18]: vmstat = subprocess.Popen(['vmstat', '1'], stdout=open('/dev/null', 'w'))
In [19]: vmstat.returncode
In [20]: vmstat.poll()
In [21]: vmstat.returncode
In [22]: vmstat.terminate()
In [23]: vmstat.returncode
In [24]: vmstat.poll()
Out[24]: -15
In [25]: vmstat.returncode
Out[25]: -15

[2] https://docs.python.org/2/library/subprocess.html#subprocess.Popen.returncode
Merge branch 'fix-finding-tessdata-dir-and-other-stuff'

* fix-finding-tessdata-dir-and-other-stuff:
  stbt.temporary_x_session: use correct check that process has exited
  stbt.py, irnetbox.py: [pylint] E265 block comment should start with '# '
  stbt.py: [pylint] E713 test for membership should be 'not in'
  stbt._find_tessdata_dir: add tessdata directory suffix for Fedora

Closes #188.
stbt batch run: Allow running inside VirtualBox shared folder

Fixes the following error:

    mkfifo: cannot create fifo ‘rawout’: Operation not permitted
    mkfifo: cannot create fifo ‘rawerr’: Operation not permitted
make check: Don't explicitly list python files to test

This increases coverage as you don't have to remember to add your python
file to the list in the Makefile.  It also saves 15 lines of Makefile.

nosetests can't check files with `-` in the name so I use the subst/
wildcard combination to filter those out.
stbt.{warn,debug,ddebug}: don't cast unicode to python-string

Commit 0f71ebe7 made all logging output encoded as utf-8. This was to
support utf-8 characters read by OCR. However, the commit did not update
the `warn`, `debug` and `ddebug` functions, which were casting their
messages to python-string type (which is ascii) and this was causing
errors because you *can't* cast utf-8 encoded characters to ascii (not
just using `str()` anyway). This was raising UnicodeEncodeError.

e.g.:
In [8]: print 'ä'
ä
In [9]: print str('ä')
ä
In [10]: print u'ä'
ä
In [11]: print str(u'ä')
---------------------------------------------------------------------------
UnicodeEncodeError                        Traceback (most recent call last)
<ipython-input-11-383a35edd348> in <module>()
----> 1 print str(u'ä')
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe4' in...
 position 0: ordinal not in range(128)

This commit fixes the issue by removing the `str()` cast. This shouldn't
cause breakage because the python string formatter `%s` used to insert
the message into the output string is *already* calling the objects
`__repr__` or `__str__` methods (so something like `debug(1)` will just
cast the `int(1)` to `str('1')` anyway).
stbt.py: Add test that we can call debug with a Unicode string

This issue was fixed by @LewisHaley in c9d5af8 and reported by Robert
Glas on the mailing list[1].  This commit adds a test so we know it
won't recur.

[1]: https://groups.google.com/forum/#!topic/stb-tester/jpVRfQ5gGyM
Merge branch 'fix-ascii-cast-of-unicode-in-debug'

Fixes github #194
release-notes: Add release notes template for 0.21

This can be filled in as we go along to save having to write the release
notes in their entirety at release time.
stbt batch: Return failure exit status if any of the tests fails

`stbt batch run` now exits with non-zero exit status if any of the tests
in the run failed or errored.  This, in combination with the `-1` option
makes it easier to use from and integrate with external CI systems.
stbt.py: Fix race condition: TypeError on NoVideo

During a NoVideo source pipeline reset `Display.source_pipeline` is
`None`.  If simultaneously `get_sample` times out stbt will try to dump
the source pipeline graph.  This causes `TypeError` to be raised:

      File ".../stbt/stbt.py", line 1493, in get_sample
        self.source_pipeline, Gst.DebugGraphDetails.ALL, "NoVideo")
    TypeError: Argument 0 does not allow None as a value

Thanks to Lewis Haley for reporting this bug and correctly diagnosing the
cause.

Fixes drothlis/#197
stbt._find_tessdata_dir: Honour TESSDATA_PREFIX

This allows me to use a locally-built (not installed) version of
tesseract for testing.