本文整理汇总了Python中tests.testutils.TestUtils.delete_dir_content方法的典型用法代码示例。如果您正苦于以下问题:Python TestUtils.delete_dir_content方法的具体用法?Python TestUtils.delete_dir_content怎么用?Python TestUtils.delete_dir_content使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tests.testutils.TestUtils
的用法示例。
在下文中一共展示了TestUtils.delete_dir_content方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_dash_d
# 需要导入模块: from tests.testutils import TestUtils [as 别名]
# 或者: from tests.testutils.TestUtils import delete_dir_content [as 别名]
def test_dash_d(self):
try:
# load album y
tu = TestUtils()
assert tu.is_env_clean(tu.conf['lycheepath']), "env not clean"
# load album x and y
tu.load_photoset("album1")
# launch lycheesync
src = tu.conf['testphotopath']
lych = tu.conf['lycheepath']
conf = tu.conf['conf']
# run
cmd = 'python main.py {} {} {} -r -v'.format(src, lych, conf)
logger.info(cmd)
retval = -1
retval = subprocess.call(cmd, shell=True)
# no crash
assert (retval == 0), "process result is ok"
assert tu.check_album_size("album1") == 1, "album 1 not correctly loaded"
# clean input pics content
tu.delete_dir_content(src)
# load album x
tu.load_photoset("album3")
# run
cmd = 'python main.py {} {} {} -v -d'.format(src, lych, conf)
logger.info(cmd)
retval = -1
retval = subprocess.call(cmd, shell=True)
# no crash
assert (retval == 0), "process result is ok"
assert tu.check_album_size("album3") == 4, "album 3 not correctly loaded"
# album 1 has been deleted
a1_check = tu.album_exists_in_db("album1")
assert not(a1_check), "album 1 still exists"
expected_albums = 1
expected_photos = 4
self.check_grand_total(expected_albums, expected_photos)
except AssertionError:
raise
except Exception as e:
logger.exception(e)
assert False
示例2: test_dash_r
# 需要导入模块: from tests.testutils import TestUtils [as 别名]
# 或者: from tests.testutils.TestUtils import delete_dir_content [as 别名]
def test_dash_r(self):
try:
tu = TestUtils()
assert tu.is_env_clean(tu.conf['lycheepath']), "env not clean"
# load album x and y
tu.load_photoset("album1")
tu.load_photoset("album3")
# launch lycheesync
src = tu.conf['testphotopath']
lych = tu.conf['lycheepath']
conf = tu.conf['conf']
# run
cmd = 'python main.py {} {} {} -r -v'.format(src, lych, conf)
logger.info(cmd)
retval = -1
retval = subprocess.call(cmd, shell=True)
# no crash
assert (retval == 0), "process result is ok"
assert tu.album_exists_in_db("album1")
# read album date for album1
album1_date = tu.get_album_creation_date('album1')
# read album date for album3
album3_date = tu.get_album_creation_date('album3')
# empty tmp pictures folder
tu.delete_dir_content(src)
tu.dump_table('lychee_albums')
# sleep 1 s to make time album signature different
time.sleep(2)
# load album3
tu.load_photoset("album3")
# run
cmd = 'python main.py {} {} {} -r -v'.format(src, lych, conf)
logger.info(cmd)
retval = -1
retval = subprocess.call(cmd, shell=True)
# no crash
assert (retval == 0), "process result is ok"
album1_date_2 = tu.get_album_creation_date('album1')
album3_date_2 = tu.get_album_creation_date('album3')
tu.dump_table('lychee_albums')
# y date < time
assert album1_date == album1_date_2, 'album 1 is untouched'
assert tu.check_album_size('album1') == 1
# x date > time
assert album3_date < album3_date_2, 'album 3 has been modified'
assert tu.check_album_size('album3') == 4
expected_albums = 2
expected_photos = 5
self.check_grand_total(expected_albums, expected_photos)
except AssertionError:
raise
except Exception as e:
logger.exception(e)
assert False