mirror of
https://github.com/ankitects/anki.git
synced 2025-11-11 15:17:12 -05:00
fix unit test on Windows
This commit is contained in:
parent
6a8ea9e65b
commit
387a5896a4
1 changed files with 7 additions and 1 deletions
|
|
@ -1,6 +1,8 @@
|
||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
|
|
||||||
import os, tempfile
|
import os, tempfile
|
||||||
|
|
||||||
|
from anki.utils import isWin
|
||||||
from tests.shared import assertException, getEmptyCol
|
from tests.shared import assertException, getEmptyCol
|
||||||
from anki.stdmodels import addBasicModel, models
|
from anki.stdmodels import addBasicModel, models
|
||||||
|
|
||||||
|
|
@ -30,8 +32,12 @@ def test_create_open():
|
||||||
deck.close()
|
deck.close()
|
||||||
|
|
||||||
# non-writeable dir
|
# non-writeable dir
|
||||||
|
if isWin:
|
||||||
|
dir = "c:\root.anki2"
|
||||||
|
else:
|
||||||
|
dir = "/attachroot.anki2"
|
||||||
assertException(Exception,
|
assertException(Exception,
|
||||||
lambda: aopen("/attachroot.anki2"))
|
lambda: aopen(dir))
|
||||||
# reuse tmp file from before, test non-writeable file
|
# reuse tmp file from before, test non-writeable file
|
||||||
os.chmod(newPath, 0)
|
os.chmod(newPath, 0)
|
||||||
assertException(Exception,
|
assertException(Exception,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue