nicolaiarocci/eve — pull request #283 by graffic (2014-03-12 14:00:04+00:00)
Title: Closes mongodb connections in tests

### What happened?

My mongodb server run out of connections while running the tests and the test suite didn't finish.

Mongodb log:
```
[initandlisten] connection accepted from 127.0.0.1:58426 #2551 (205 connections now open)
[initandlisten] connection refused because too many open connections: 204
```

### What is going on in the tests?

Every test starts an `Eve(...)` application. This configures pymongo once per test. It seems that even the `self.app` is overwritten in each test, the database connection is not closed.

Even more, in some tests another instance is created in the specific `TestCase.setUp` method. And some individual tests create another instance using `self.app`.

### Exposed solution

Because many apps are added to `self.app`, the idea is to collect them all, and when the test finishes, close the connections. So self.app is a special descriptor that stores all the applications assigned to `self.app`.

### Known problems
The descriptor is not thread safe, but the tests in eve are not designed to run in parallel (Ex: dropping the same database another test is running).