docker/fig — pull request #396 by dnephin (2014-08-10 15:24:34+00:00)
Title: Remove extra calls, test bug fixes

When I ran `fig --verbose ps` I noticed a lot of repeated calls to the docker server (with the same args). I believe these extra calls are unnecessary.

There were two causes for these repeated calls:
* `project.containers()` calls `service.containers()` in a loop, and each call requires a full list from `client.containers()` again
* `container.inspect()` was not setting `has_been_inspected` to True, causing each iteration to re-inspect a container that was already inspected.

To remove these extra calls I moved the `client.containers()` call up into project, and split out a filter (`has_container()`) in service. This allows both `containers()` implementations to be just a single for-comprehension.

Set `has_been_inspected = True` in `inspect()`.

While working on these changes I noticed that some tests in ` tests/integration/project_test.py` where actually using the wrong variable (a local from the comprehension scope, instead of the result of the comprehension). This passes in most cases, but can actually fail if you have more copies of these containers.