fix unit test on Windows

This commit is contained in:
Damien Elmes 2019-12-24 19:14:48 +10:00
parent 6a8ea9e65b
commit 387a5896a4

View File

@ -1,6 +1,8 @@
# coding: utf-8
import os, tempfile
from anki.utils import isWin
from tests.shared import assertException, getEmptyCol
from anki.stdmodels import addBasicModel, models
@ -30,8 +32,12 @@ def test_create_open():
deck.close()
# non-writeable dir
if isWin:
dir = "c:\root.anki2"
else:
dir = "/attachroot.anki2"
assertException(Exception,
lambda: aopen("/attachroot.anki2"))
lambda: aopen(dir))
# reuse tmp file from before, test non-writeable file
os.chmod(newPath, 0)
assertException(Exception,