anki/tests/shared.py
Damien Elmes 0d1d8c5bf9 define standard encoding for unicode (#893)
- always store media references in fields in NFC form
- always encode filenames on disk in NFC form on machines other than macs
- use relevant encoding when placing files in the media folder during syncs
  and apkg imports as well
- rename 'unused media' back to 'check media'
- check media can now automatically change media references and filename
  encodings to the correct format
2013-09-20 19:28:44 +09:00

24 lines
575 B
Python

import tempfile, os, shutil
from anki import Collection as aopen
def assertException(exception, func):
found = False
try:
func()
except exception:
found = True
assert found
def getEmptyDeck(**kwargs):
(fd, nam) = tempfile.mkstemp(suffix=".anki2")
os.unlink(nam)
return aopen(nam, **kwargs)
def getUpgradeDeckPath(name="anki12.anki"):
src = os.path.join(testDir, "support", name)
(fd, dst) = tempfile.mkstemp(suffix=".anki2")
shutil.copy(src, dst)
return unicode(dst, "utf8")
testDir = os.path.dirname(__file__)