merged with master
This commit is contained in:
commit
ed508babbf
18
.github/workflows/tests.yml
vendored
18
.github/workflows/tests.yml
vendored
@ -48,6 +48,24 @@ jobs:
|
|||||||
- name: Anki 2.1.53 (Qt6)
|
- name: Anki 2.1.53 (Qt6)
|
||||||
python: 3.9
|
python: 3.9
|
||||||
environment: py39-anki2.1.53-qt6
|
environment: py39-anki2.1.53-qt6
|
||||||
|
- name: Anki 2.1.54 (Qt5)
|
||||||
|
python: 3.9
|
||||||
|
environment: py39-anki2.1.54-qt5
|
||||||
|
- name: Anki 2.1.54 (Qt6)
|
||||||
|
python: 3.9
|
||||||
|
environment: py39-anki2.1.54-qt6
|
||||||
|
- name: Anki 2.1.55 (Qt5)
|
||||||
|
python: 3.9
|
||||||
|
environment: py39-anki2.1.55-qt5
|
||||||
|
- name: Anki 2.1.55 (Qt6)
|
||||||
|
python: 3.9
|
||||||
|
environment: py39-anki2.1.55-qt6
|
||||||
|
- name: Anki 2.1.56 (Qt5)
|
||||||
|
python: 3.9
|
||||||
|
environment: py39-anki2.1.56-qt5
|
||||||
|
- name: Anki 2.1.56 (Qt6)
|
||||||
|
python: 3.9
|
||||||
|
environment: py39-anki2.1.56-qt6
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
@ -350,17 +350,22 @@ class AnkiConnect:
|
|||||||
# Not a duplicate
|
# Not a duplicate
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
def raiseNotFoundError(self, errorMsg):
|
||||||
|
if anki_version < (2, 1, 55):
|
||||||
|
raise NotFoundError(errorMsg)
|
||||||
|
raise NotFoundError(errorMsg, None, None, None)
|
||||||
|
|
||||||
def getCard(self, card_id: int) -> Card:
|
def getCard(self, card_id: int) -> Card:
|
||||||
try:
|
try:
|
||||||
return self.collection().getCard(card_id)
|
return self.collection().getCard(card_id)
|
||||||
except NotFoundError:
|
except NotFoundError:
|
||||||
raise NotFoundError('Card was not found: {}'.format(card_id))
|
self.raiseNotFoundError('Card was not found: {}'.format(card_id))
|
||||||
|
|
||||||
def getNote(self, note_id: int) -> Note:
|
def getNote(self, note_id: int) -> Note:
|
||||||
try:
|
try:
|
||||||
return self.collection().getNote(note_id)
|
return self.collection().getNote(note_id)
|
||||||
except NotFoundError:
|
except NotFoundError:
|
||||||
raise NotFoundError('Note was not found: {}'.format(note_id))
|
self.raiseNotFoundError('Note was not found: {}'.format(note_id))
|
||||||
|
|
||||||
def deckStatsToJson(self, due_tree):
|
def deckStatsToJson(self, due_tree):
|
||||||
deckStats = {'deck_id': due_tree.deck_id,
|
deckStats = {'deck_id': due_tree.deck_id,
|
||||||
@ -717,6 +722,9 @@ class AnkiConnect:
|
|||||||
except AttributeError:
|
except AttributeError:
|
||||||
self.media().trash_files([filename])
|
self.media().trash_files([filename])
|
||||||
|
|
||||||
|
@util.api()
|
||||||
|
def getMediaDirPath(self):
|
||||||
|
return os.path.abspath(self.media().dir())
|
||||||
|
|
||||||
@util.api()
|
@util.api()
|
||||||
def addNote(self, note):
|
def addNote(self, note):
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import base64
|
import base64
|
||||||
|
import os.path
|
||||||
|
|
||||||
from conftest import ac
|
from conftest import ac
|
||||||
|
|
||||||
@ -49,3 +50,7 @@ def test_deleteMediaFile(session_with_profile_loaded):
|
|||||||
ac.deleteMediaFile(filename=filename_1)
|
ac.deleteMediaFile(filename=filename_1)
|
||||||
assert ac.retrieveMediaFile(filename=filename_1) is False
|
assert ac.retrieveMediaFile(filename=filename_1) is False
|
||||||
assert ac.getMediaFilesNames(pattern="_tes*.txt") == [filename_2]
|
assert ac.getMediaFilesNames(pattern="_tes*.txt") == [filename_2]
|
||||||
|
|
||||||
|
|
||||||
|
def test_getMediaDirPath(session_with_profile_loaded):
|
||||||
|
assert os.path.isdir(ac.getMediaDirPath())
|
||||||
|
2
tox.ini
2
tox.ini
@ -54,7 +54,7 @@ requires =
|
|||||||
pypi-timemachine
|
pypi-timemachine
|
||||||
envlist =
|
envlist =
|
||||||
py38-anki2.1.{45,46,47,48,49}
|
py38-anki2.1.{45,46,47,48,49}
|
||||||
py39-anki2.1.{50,51,52,53}-qt{5,6}
|
py39-anki2.1.{50,51,52,53,54,55,56}-qt{5,6}
|
||||||
|
|
||||||
[testenv:.tox]
|
[testenv:.tox]
|
||||||
install_command =
|
install_command =
|
||||||
|
Loading…
Reference in New Issue
Block a user