mirror of
https://github.com/ankitects/anki.git
synced 2025-09-20 23:12:21 -04:00
fix unit test, badstatusline error
This commit is contained in:
parent
5ad662cf95
commit
cdd2be3548
2 changed files with 6 additions and 3 deletions
|
@ -21,7 +21,7 @@ createDeck(name): create a deck on the server
|
||||||
__docformat__ = 'restructuredtext'
|
__docformat__ = 'restructuredtext'
|
||||||
|
|
||||||
import zlib, re, urllib, urllib2, socket, simplejson, time
|
import zlib, re, urllib, urllib2, socket, simplejson, time
|
||||||
import os, base64
|
import os, base64, httplib
|
||||||
from datetime import date
|
from datetime import date
|
||||||
import anki, anki.deck, anki.cards
|
import anki, anki.deck, anki.cards
|
||||||
from anki.errors import *
|
from anki.errors import *
|
||||||
|
@ -960,7 +960,8 @@ class HttpSyncServerProxy(SyncServer):
|
||||||
data = urllib.urlencode(data)
|
data = urllib.urlencode(data)
|
||||||
try:
|
try:
|
||||||
f = urllib2.urlopen(self.syncURL + action, data)
|
f = urllib2.urlopen(self.syncURL + action, data)
|
||||||
except (urllib2.URLError, socket.error, socket.timeout):
|
except (urllib2.URLError, socket.error, socket.timeout,
|
||||||
|
httplib.BadStatusLine):
|
||||||
raise SyncError(type="noResponse")
|
raise SyncError(type="noResponse")
|
||||||
ret = f.read()
|
ret = f.read()
|
||||||
if not ret:
|
if not ret:
|
||||||
|
@ -1092,7 +1093,8 @@ class BulkMediaSyncerProxy(HttpSyncServerProxy):
|
||||||
data = urllib.urlencode(data)
|
data = urllib.urlencode(data)
|
||||||
try:
|
try:
|
||||||
f = urllib2.urlopen(self.syncURL + action, data)
|
f = urllib2.urlopen(self.syncURL + action, data)
|
||||||
except (urllib2.URLError, socket.error, socket.timeout):
|
except (urllib2.URLError, socket.error, socket.timeout,
|
||||||
|
httplib.BadStatusLine):
|
||||||
raise SyncError(type="noResponse")
|
raise SyncError(type="noResponse")
|
||||||
ret = f.read()
|
ret = f.read()
|
||||||
if not ret:
|
if not ret:
|
||||||
|
|
|
@ -236,6 +236,7 @@ def test_localsync_media():
|
||||||
assert deck2.s.scalar("select count(1) from media") == 3
|
assert deck2.s.scalar("select count(1) from media") == 3
|
||||||
# check delete
|
# check delete
|
||||||
os.unlink(os.path.join(deck1media, "22161b29b0c18e068038021f54eee1ee.png"))
|
os.unlink(os.path.join(deck1media, "22161b29b0c18e068038021f54eee1ee.png"))
|
||||||
|
time.sleep(0.1)
|
||||||
rebuildMediaDir(deck1)
|
rebuildMediaDir(deck1)
|
||||||
client.sync()
|
client.sync()
|
||||||
assert deck1.s.scalar("select count(1) from media") == 2
|
assert deck1.s.scalar("select count(1) from media") == 2
|
||||||
|
|
Loading…
Reference in a new issue