mirror of
https://github.com/SickGear/SickGear.git
synced 2025-01-07 10:33:38 +00:00
Merge pull request #33 from adam111316/feature/AddFailedDatabaseUnitTest
Add failed database to unit tests tear down function
This commit is contained in:
commit
9b69b18346
2 changed files with 13 additions and 5 deletions
|
@ -45,6 +45,8 @@
|
||||||
* Change case of labels in General Config/Interface/Timezone
|
* Change case of labels in General Config/Interface/Timezone
|
||||||
* Split enabled from not enabled providers in the Configure Provider drop down on the Providers Options tab
|
* Split enabled from not enabled providers in the Configure Provider drop down on the Providers Options tab
|
||||||
* Fix searches freezing due to unescaped ignored or required words
|
* Fix searches freezing due to unescaped ignored or required words
|
||||||
|
* Add failed database to unit tests tear down function
|
||||||
|
* Fix purging of database files in tear down function during unit tests
|
||||||
|
|
||||||
[develop changelog]
|
[develop changelog]
|
||||||
* Fix typo for commit "ShowData handler" i.e. SHA-1:3eec217
|
* Fix typo for commit "ShowData handler" i.e. SHA-1:3eec217
|
||||||
|
|
|
@ -34,7 +34,7 @@ import shutil
|
||||||
from sickbeard import encodingKludge as ek, providers, tvcache
|
from sickbeard import encodingKludge as ek, providers, tvcache
|
||||||
from sickbeard import db
|
from sickbeard import db
|
||||||
from sickbeard.databases import mainDB
|
from sickbeard.databases import mainDB
|
||||||
from sickbeard.databases import cache_db
|
from sickbeard.databases import cache_db, failed_db
|
||||||
|
|
||||||
#=================
|
#=================
|
||||||
# test globals
|
# test globals
|
||||||
|
@ -42,7 +42,7 @@ from sickbeard.databases import cache_db
|
||||||
TESTDIR = os.path.abspath('.')
|
TESTDIR = os.path.abspath('.')
|
||||||
TESTDBNAME = "sickbeard.db"
|
TESTDBNAME = "sickbeard.db"
|
||||||
TESTCACHEDBNAME = "cache.db"
|
TESTCACHEDBNAME = "cache.db"
|
||||||
|
TESTFAILEDDBNAME = "failed.db"
|
||||||
|
|
||||||
SHOWNAME = u"show name"
|
SHOWNAME = u"show name"
|
||||||
SEASON = 4
|
SEASON = 4
|
||||||
|
@ -102,6 +102,7 @@ createTestCacheFolder()
|
||||||
#=================
|
#=================
|
||||||
def _dummy_saveConfig():
|
def _dummy_saveConfig():
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# this overrides the sickbeard save_config which gets called during a db upgrade
|
# this overrides the sickbeard save_config which gets called during a db upgrade
|
||||||
# this might be considered a hack
|
# this might be considered a hack
|
||||||
mainDB.sickbeard.save_config = _dummy_saveConfig
|
mainDB.sickbeard.save_config = _dummy_saveConfig
|
||||||
|
@ -165,7 +166,6 @@ class TestCacheDBConnection(TestDBConnection, object):
|
||||||
sickbeard.db.DBConnection = TestDBConnection
|
sickbeard.db.DBConnection = TestDBConnection
|
||||||
sickbeard.tvcache.CacheDBConnection = TestCacheDBConnection
|
sickbeard.tvcache.CacheDBConnection = TestCacheDBConnection
|
||||||
|
|
||||||
|
|
||||||
#=================
|
#=================
|
||||||
# test functions
|
# test functions
|
||||||
#=================
|
#=================
|
||||||
|
@ -174,23 +174,29 @@ def setUp_test_db():
|
||||||
"""
|
"""
|
||||||
# upgrading the db
|
# upgrading the db
|
||||||
db.upgradeDatabase(db.DBConnection(), mainDB.InitialSchema)
|
db.upgradeDatabase(db.DBConnection(), mainDB.InitialSchema)
|
||||||
|
|
||||||
# fix up any db problems
|
# fix up any db problems
|
||||||
db.sanityCheckDatabase(db.DBConnection(), mainDB.MainSanityCheck)
|
db.sanityCheckDatabase(db.DBConnection(), mainDB.MainSanityCheck)
|
||||||
|
|
||||||
#and for cache.b too
|
# and for cachedb too
|
||||||
db.upgradeDatabase(db.DBConnection("cache.db"), cache_db.InitialSchema)
|
db.upgradeDatabase(db.DBConnection("cache.db"), cache_db.InitialSchema)
|
||||||
|
|
||||||
|
# and for faileddb too
|
||||||
|
db.upgradeDatabase(db.DBConnection("failed.db"), failed_db.InitialSchema)
|
||||||
|
|
||||||
|
|
||||||
def tearDown_test_db():
|
def tearDown_test_db():
|
||||||
"""Deletes the test db
|
"""Deletes the test db
|
||||||
although this seams not to work on my system it leaves me with an zero kb file
|
although this seams not to work on my system it leaves me with an zero kb file
|
||||||
"""
|
"""
|
||||||
# uncomment next line so leave the db intact between test and at the end
|
# uncomment next line so leave the db intact between test and at the end
|
||||||
return False
|
#return False
|
||||||
if os.path.exists(os.path.join(TESTDIR, TESTDBNAME)):
|
if os.path.exists(os.path.join(TESTDIR, TESTDBNAME)):
|
||||||
os.remove(os.path.join(TESTDIR, TESTDBNAME))
|
os.remove(os.path.join(TESTDIR, TESTDBNAME))
|
||||||
if os.path.exists(os.path.join(TESTDIR, TESTCACHEDBNAME)):
|
if os.path.exists(os.path.join(TESTDIR, TESTCACHEDBNAME)):
|
||||||
os.remove(os.path.join(TESTDIR, TESTCACHEDBNAME))
|
os.remove(os.path.join(TESTDIR, TESTCACHEDBNAME))
|
||||||
|
if os.path.exists(os.path.join(TESTDIR, TESTFAILEDDBNAME)):
|
||||||
|
os.remove(os.path.join(TESTDIR, TESTFAILEDDBNAME))
|
||||||
|
|
||||||
|
|
||||||
def setUp_test_episode_file():
|
def setUp_test_episode_file():
|
||||||
|
|
Loading…
Reference in a new issue