Change fulldbtests to use py.test

This commit is contained in:
Joseph Schorr 2017-04-24 15:52:50 -04:00
parent 6ba7ed4cd6
commit a1a4b68306
3 changed files with 79 additions and 15 deletions

View file

@ -20,7 +20,7 @@ from data.database import (db, all_models, beta_classes, Role, TeamRole, Visibil
ExternalNotificationEvent, ExternalNotificationMethod, NotificationKind,
QuayRegion, QuayService, UserRegion, OAuthAuthorizationCode,
ServiceKeyApprovalType, MediaType, LabelSourceType, UserPromptKind,
RepositoryKind, TagKind, BlobPlacementLocation)
RepositoryKind, TagKind, BlobPlacementLocation, User)
from data import model
from data.queue import WorkQueue
from app import app, storage as store, tf
@ -440,6 +440,15 @@ def wipe_database():
def populate_database(minimal=False, with_storage=False):
logger.debug('Populating the DB with test data.')
# Check if the data already exists. If so, we skip. This can happen between calls from the
# "old style" tests and the new py.test's.
try:
User.get(username='devtable')
logger.debug('DB already populated')
return
except User.DoesNotExist:
pass
# Note: databases set up with "real" schema (via Alembic) will not have these types
# type, so we it here it necessary.
try: