tests: Introduce AssertingLock

When we want to test locking, we don't want to poke into object
internals and check the state of objects locks, or even worse, mock out
object lock.

This patch introduces the AssertingLock, which unlike regular locks,
never blocks when you try to acquire a lock somebody else is holding.
Instead, this lock raises AssertionError, failing the test.

Assuming that Foo object implements the context manager and use a lock,
we can verify this by:

    single_thread = AssertingLock()
    foo = Foo()

    def check():
        with foo:
            with single_thread:
                time.sleep(0.1)

Now we can run check in several threads; if foo is implemented
correctly, single thread will be able to enter the foo context. If foo
does not lock properly, multiple thread will enter this context, and
then fail when trying to enter the AssertingLock.

Turns out that in the SamplingMethodTests, I used a BoundedSemaphore for
this purpuse which is incorrect. Incorrect code can be hidden becuase
the testing threads would block instead of failing the tests. This code
uses now an AssertingLock instead.

Change-Id: I3e3aad4015e3410ce2f2b39bba84314cce5580b6
Signed-off-by: Nir Soffer <nsoffer@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/30938
Reviewed-by: Federico Simoncelli <fsimonce@redhat.com>