コード例 #1
0
ファイル: test_mongo_observer.py プロジェクト: IDSIA/sacred
def test_create_should_raise_error_on_non_pymongo_client():
    client = mongomock.MongoClient()
    with pytest.raises(ValueError):
        MongoObserver.create(client=client)
コード例 #2
0
ファイル: test_mongo_observer.py プロジェクト: IDSIA/sacred
def test_create_should_raise_error_on_both_client_and_url():
    real_client = pymongo.MongoClient()
    with pytest.raises(ValueError,
                       match="Cannot pass both a client and a url."):
        MongoObserver.create(client=real_client, url="mymongourl")
コード例 #3
0
ファイル: test_mongo_observer.py プロジェクト: remss/sacred
def mongo_obs():
    db = mongomock.MongoClient().db
    runs = db.runs
    fs = mock.MagicMock()
    return MongoObserver(runs, fs)