コード例 #1
0
ファイル: test_pickleddb.py プロジェクト: Delaunay/orion
def write(field, i):
    """Write the given value to the pickled db."""
    PickledDB.instance = None
    orion_db = PickledDB(host='orion_db.pkl')
    try:
        orion_db.write('concurrent', {field: i})
    except DuplicateKeyError:
        print('dup')
        pass

    print(field, i)
コード例 #2
0
ファイル: database_test.py プロジェクト: lebrice/orion
    def test_instantiation_and_singleton(self):
        """Test create just one object, that object persists between calls."""
        database = Database(of_type="PickledDB", name="orion_test")

        assert isinstance(database, PickledDB)
        assert database is PickledDB()
        assert database is Database()

        with pytest.raises(SingletonAlreadyInstantiatedError):
            Database("fire", [], {"it_matters": "it's singleton"})
コード例 #3
0
ファイル: test_pickleddb.py プロジェクト: Delaunay/orion
def orion_db():
    """Return PickledDB wrapper instance initiated with test opts."""
    PickledDB.instance = None
    orion_db = PickledDB(host='orion_db.pkl')
    yield orion_db