本文整理汇总了Python中c3smembership.models.DBSession.remove方法的典型用法代码示例。如果您正苦于以下问题:Python DBSession.remove方法的具体用法?Python DBSession.remove怎么用?Python DBSession.remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类c3smembership.models.DBSession
的用法示例。
在下文中一共展示了DBSession.remove方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: tearDown
# 需要导入模块: from c3smembership.models import DBSession [as 别名]
# 或者: from c3smembership.models.DBSession import remove [as 别名]
def tearDown(self):
# maybe I need to check and remove globals here,
# so the other tests are not compromised
#del engine
from c3smembership.models import DBSession
DBSession.close()
DBSession.remove()
示例2: tearDown
# 需要导入模块: from c3smembership.models import DBSession [as 别名]
# 或者: from c3smembership.models.DBSession import remove [as 别名]
def tearDown(self):
"""
clean up after a test case
"""
DBSession.close()
DBSession.remove()
testing.tearDown()
示例3: setUp
# 需要导入模块: from c3smembership.models import DBSession [as 别名]
# 或者: from c3smembership.models.DBSession import remove [as 别名]
def setUp(self):
self.config = testing.setUp()
self.config.include('pyramid_mailer.testing')
self.config.registry.settings['c3smembership.url'] = 'http://foo.com'
self.config.registry.settings['c3smembership.mailaddr'] = '[email protected]'
DBSession.remove()
self.session = _initTestingDB()
示例4: setUp
# 需要导入模块: from c3smembership.models import DBSession [as 别名]
# 或者: from c3smembership.models.DBSession import remove [as 别名]
def setUp(self):
self.config = testing.setUp()
self.config.include('pyramid_mailer.testing')
try:
DBSession.close()
DBSession.remove()
#print("removed old DBSession ===================================")
except:
#print("no DBSession to remove ==================================")
pass
#try:
# os.remove('test_webtest_functional.db')
# #print "deleted old test database"
#except:
# pass
# #print "never mind"
my_settings = {
#'sqlalchemy.url': 'sqlite:///test_webtest_functional.db',
'sqlalchemy.url': 'sqlite:///:memory:',
'available_languages': 'da de en es fr',
'c3smembership.mailaddr': '[email protected]'}
engine = engine_from_config(my_settings)
DBSession.configure(bind=engine)
self.session = DBSession # ()
Base.metadata.create_all(engine)
# dummy database entries for testing
with transaction.manager:
member1 = C3sMember( # german
firstname=u'SomeFirstnäme',
lastname=u'SomeLastnäme',
email=u'[email protected]',
address1=u"addr one",
address2=u"addr two",
postcode=u"12345",
city=u"Footown Mäh",
country=u"Foocountry",
locale=u"DE",
date_of_birth=date.today(),
email_is_confirmed=False,
email_confirm_code=u'ABCDEFGFOO',
password=u'arandompassword',
date_of_submission=date.today(),
membership_type=u'normal',
member_of_colsoc=True,
name_of_colsoc=u"GEMA",
num_shares=u'23',
)
DBSession.add(member1)
DBSession.flush()
from c3smembership import main
app = main({}, **my_settings)
from webtest import TestApp
self.testapp = TestApp(app)
示例5: setUp
# 需要导入模块: from c3smembership.models import DBSession [as 别名]
# 或者: from c3smembership.models.DBSession import remove [as 别名]
def setUp(self):
"""
set up everything for a test case
"""
self.config = testing.setUp()
self.config.include('pyramid_mailer.testing')
try:
DBSession.remove()
except:
pass
self.session = _initTestingDB()
示例6: setUp
# 需要导入模块: from c3smembership.models import DBSession [as 别名]
# 或者: from c3smembership.models.DBSession import remove [as 别名]
def setUp(self):
self.config = testing.setUp()
self.config.include('pyramid_mailer.testing')
try:
DBSession.remove()
#print("removing old DBSession ===================================")
except:
#print("no DBSession to remove ===================================")
pass
engine = create_engine('sqlite:///test_models.db')
self.session = DBSession
DBSession.configure(bind=engine) # XXX does influence self.session!?!
Base.metadata.create_all(engine)
示例7: setUp
# 需要导入模块: from c3smembership.models import DBSession [as 别名]
# 或者: from c3smembership.models.DBSession import remove [as 别名]
def setUp(self):
self.config = testing.setUp()
self.config.include('pyramid_mailer.testing')
try:
DBSession.remove()
except:
pass
#engine = create_engine('sqlite:///test_model_staff.db')
engine = create_engine('sqlite://')
self.session = DBSession
self.session.configure(bind=engine)
Base.metadata.create_all(engine)
with transaction.manager:
group1 = Group(name=u'staff')
group2 = Group(name=u'staff2')
DBSession.add(group1, group2)
DBSession.flush()
示例8: setUp
# 需要导入模块: from c3smembership.models import DBSession [as 别名]
# 或者: from c3smembership.models.DBSession import remove [as 别名]
def setUp(self):
"""
set up everything for a test case
"""
self.config = testing.setUp()
self.config.include('pyramid_mailer.testing')
try:
DBSession.close()
DBSession.remove()
#print("removing old DBSession ===================================")
except:
#print("no DBSession to remove ===================================")
pass
from sqlalchemy import create_engine
#engine = create_engine('sqlite:///test_utils.db')
engine = create_engine('sqlite:///:memory:')
DBSession.configure(bind=engine)
self.session = DBSession # ()
Base.metadata.create_all(engine)
with transaction.manager:
member1 = C3sMember( # german
firstname=u'SomeFirstnäme',
lastname=u'SomeLastnäme',
email=u'[email protected]',
address1=u"addr one",
address2=u"addr two",
postcode=u"12345",
city=u"Footown Mäh",
country=u"Foocountry",
locale=u"DE",
date_of_birth=date.today(),
email_is_confirmed=False,
email_confirm_code=u'ABCDEFGBAR',
password=u'arandompassword',
date_of_submission=date.today(),
membership_type=u'normal',
member_of_colsoc=True,
name_of_colsoc=u"GEMA",
num_shares=u'23',
)
DBSession.add(member1)
DBSession.flush()
示例9: tearDown
# 需要导入模块: from c3smembership.models import DBSession [as 别名]
# 或者: from c3smembership.models.DBSession import remove [as 别名]
def tearDown(self):
DBSession.remove()
testing.tearDown()
示例10: setUp
# 需要导入模块: from c3smembership.models import DBSession [as 别名]
# 或者: from c3smembership.models.DBSession import remove [as 别名]
def setUp(self):
self.config = testing.setUp()
self.config.include('pyramid_mailer.testing')
DBSession.remove()
self.session = _initTestingDB()
示例11: tearDown
# 需要导入模块: from c3smembership.models import DBSession [as 别名]
# 或者: from c3smembership.models.DBSession import remove [as 别名]
def tearDown(self):
DBSession.close()
DBSession.remove()
os.remove('test_webtest_accountants.db')
testing.tearDown()
示例12: setUp
# 需要导入模块: from c3smembership.models import DBSession [as 别名]
# 或者: from c3smembership.models.DBSession import remove [as 别名]
def setUp(self):
self.config = testing.setUp()
self.config.include('pyramid_mailer.testing')
try:
DBSession.close()
DBSession.remove()
#print "closed and removed DBSession"
except:
pass
#print "no session to close"
#try:
# os.remove('test_import.db')
# #print "deleted old test database"
#except:
# pass
# #print "never mind"
# self.session = DBSession()
my_settings = {
#'sqlalchemy.url': 'sqlite:///test_import.db',
'sqlalchemy.url': 'sqlite:///:memory:',
'available_languages': 'da de en es fr',
'c3smembership.dashboard_number': '30'}
engine = engine_from_config(my_settings)
DBSession.configure(bind=engine)
Base.metadata.create_all(engine)
with transaction.manager:
member1 = C3sMember( # german
firstname=u'SomeFirstnäme',
lastname=u'SomeLastnäme',
email=u'[email protected]',
address1=u"addr one",
address2=u"addr two",
postcode=u"12345",
city=u"Footown Mäh",
country=u"Foocountry",
locale=u"DE",
date_of_birth=date.today(),
email_is_confirmed=False,
email_confirm_code=u'ABCDEFGFOO',
password=u'arandompassword',
date_of_submission=date.today(),
membership_type=u'normal',
member_of_colsoc=True,
name_of_colsoc=u"GEMA",
num_shares=u'23',
)
DBSession.add(member1)
DBSession.flush()
self.m1_last_pw_change = member1.last_password_change
with transaction.manager:
# a group for accountants/staff
accountants_group = Group(name=u"staff")
try:
DBSession.add(accountants_group)
DBSession.flush()
#print("adding group staff")
except:
#print("could not add group staff.")
pass
# staff personnel
staffer1 = C3sStaff(
login=u"rut",
password=u"berries",
email=u"[email protected]",
)
staffer1.groups = [accountants_group]
try:
DBSession.add(accountants_group)
DBSession.add(staffer1)
DBSession.flush()
except:
#print("it borked! (rut)")
pass
from c3smembership import main
app = main({}, **my_settings)
from webtest import TestApp
self.testapp = TestApp(app)
示例13: tearDown
# 需要导入模块: from c3smembership.models import DBSession [as 别名]
# 或者: from c3smembership.models.DBSession import remove [as 别名]
def tearDown(self):
DBSession.close()
DBSession.remove()
#os.remove('test_import.db')
testing.tearDown()
示例14: setUp
# 需要导入模块: from c3smembership.models import DBSession [as 别名]
# 或者: from c3smembership.models.DBSession import remove [as 别名]
def setUp(self):
self.config = testing.setUp()
# import pdb; pdb.set_trace()
# shutil.move('c3sMembership.db', 'c3sMembership.db.old')
DBSession.remove()
self.session = _initTestingDB()