def load(mod):
     return rprt("%s..."%(moduleName)) and testMod(mod)
 def conclude(results):
     return 0 if results else rprt("\nFAILURES!\n\n") and 1
Example #3
0
from observation import extractObs
from diagnostics import test, reportyFunc
from flow import pipeline
from bson.objectid import ObjectId
from proggy import ahoy
from display import rprt
from fileio import readBytes
from functools import partial
import sys, os, time
try:
    import pymongo
except ImportError:
    rprt('''Can't load pymongo module.  It probably isn't installed.
All database reporting will fail until pymongo can be imported.
Use your package manager to install pymongo.
e.g.
# apt-get install python-pymongo # Debian variants
# pacman -Syu python2-pymongo    # Arch 
# yum install pymongo            # redhat-like systems''')

# The testability of this code is _way_ low
# So much relies on the state of a remote host.
# This calls for more second-rigor testing. :(
def establishConnection(host, port=27017):
    return host and pymongo.Connection(host, port)

def useDatabase(connection, dbName='ebdb'):
    return connection and connection[dbName]

def getCollectionObj(collection, database):
    return database and database[collection]