mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 22:42:25 -04:00
add tests and setup.py to checks; fix warnings
This commit is contained in:
parent
82f0db7583
commit
947d35dfca
10 changed files with 41 additions and 39 deletions
|
@ -5,8 +5,8 @@ MAKEFLAGS += --warn-undefined-variables
|
|||
MAKEFLAGS += --no-builtin-rules
|
||||
RUNARGS :=
|
||||
.SUFFIXES:
|
||||
BLACKARGS := -t py36 anki tests --exclude='backend_pb2|buildinfo'
|
||||
ISORTARGS := anki tests
|
||||
BLACKARGS := -t py36 anki tests setup.py --exclude='backend_pb2|buildinfo'
|
||||
ISORTARGS := anki tests setup.py
|
||||
|
||||
$(shell mkdir -p .build ../dist)
|
||||
|
||||
|
@ -58,7 +58,7 @@ CHECKDEPS := $(shell find anki tests -name '*.py')
|
|||
@touch $@
|
||||
|
||||
.build/lint: $(CHECKDEPS)
|
||||
pylint -j 0 --rcfile=.pylintrc -f colorized --extension-pkg-whitelist=ankirspy anki
|
||||
pylint -j 0 --rcfile=.pylintrc -f colorized --extension-pkg-whitelist=ankirspy anki tests setup.py
|
||||
@touch $@
|
||||
|
||||
.build/imports: $(CHECKDEPS)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import setuptools, sys
|
||||
import setuptools
|
||||
|
||||
with open("../meta/version") as fh:
|
||||
version = fh.read().strip()
|
||||
|
@ -12,15 +12,14 @@ setuptools.setup(
|
|||
long_description_content_type="text/markdown",
|
||||
url="https://apps.ankiweb.net",
|
||||
packages=setuptools.find_packages(".", exclude=["tests"]),
|
||||
classifiers=[
|
||||
],
|
||||
python_requires='>=3.6',
|
||||
classifiers=[],
|
||||
python_requires=">=3.6",
|
||||
install_requires=[
|
||||
'beautifulsoup4',
|
||||
'requests',
|
||||
'decorator',
|
||||
'protobuf',
|
||||
"beautifulsoup4",
|
||||
"requests",
|
||||
"decorator",
|
||||
"protobuf",
|
||||
'psutil; sys_platform == "win32"',
|
||||
'distro; sys_platform != "darwin" and sys_platform != "win32"'
|
||||
]
|
||||
'distro; sys_platform != "darwin" and sys_platform != "win32"',
|
||||
],
|
||||
)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from tests.shared import assertException, getEmptyCol
|
||||
from tests.shared import getEmptyCol
|
||||
|
||||
|
||||
def test_flags():
|
||||
|
|
|
@ -10,7 +10,6 @@ from anki.importing import (
|
|||
SupermemoXmlImporter,
|
||||
TextImporter,
|
||||
)
|
||||
from anki.utils import ids2str
|
||||
from tests.shared import getEmptyCol, getUpgradeDeckPath
|
||||
|
||||
testDir = os.path.dirname(__file__)
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
import os
|
||||
import tempfile
|
||||
import time
|
||||
|
||||
from .shared import getEmptyCol, testDir
|
||||
|
||||
|
|
|
@ -338,7 +338,7 @@ def test_modelChange():
|
|||
assert deck.db.scalar("select count() from cards where nid = ?", f.id) == 1
|
||||
|
||||
|
||||
def test_templates():
|
||||
def test_templates2():
|
||||
d = dict(Foo="x", Bar="y")
|
||||
assert anki.template.render("{{Foo}}", d) == "x"
|
||||
assert anki.template.render("{{#Foo}}{{Foo}}{{/Foo}}", d) == "x"
|
||||
|
|
|
@ -405,7 +405,7 @@ def test_button_spacing():
|
|||
def test_overdue_lapse():
|
||||
# disabled in commit 3069729776990980f34c25be66410e947e9d51a2
|
||||
return
|
||||
d = getEmptyCol()
|
||||
d = getEmptyCol() # pylint: disable=unreachable
|
||||
# add a note
|
||||
f = d.newNote()
|
||||
f["Front"] = "one"
|
||||
|
|
|
@ -496,7 +496,7 @@ def test_button_spacing():
|
|||
def test_overdue_lapse():
|
||||
# disabled in commit 3069729776990980f34c25be66410e947e9d51a2
|
||||
return
|
||||
d = getEmptyCol()
|
||||
d = getEmptyCol() # pylint: disable=unreachable
|
||||
# add a note
|
||||
f = d.newNote()
|
||||
f["Front"] = "one"
|
||||
|
@ -622,28 +622,30 @@ def test_bury():
|
|||
d.addNote(f)
|
||||
c2 = f.cards()[0]
|
||||
# burying
|
||||
d.sched.buryCards([c.id], manual=True)
|
||||
d.sched.buryCards([c.id], manual=True) # pylint: disable=unexpected-keyword-arg
|
||||
c.load()
|
||||
assert c.queue == -3
|
||||
d.sched.buryCards([c2.id], manual=False)
|
||||
d.sched.buryCards([c2.id], manual=False) # pylint: disable=unexpected-keyword-arg
|
||||
c2.load()
|
||||
assert c2.queue == -2
|
||||
|
||||
d.reset()
|
||||
assert not d.sched.getCard()
|
||||
|
||||
d.sched.unburyCardsForDeck(type="manual")
|
||||
d.sched.unburyCardsForDeck(type="manual") # pylint: disable=unexpected-keyword-arg
|
||||
c.load()
|
||||
assert c.queue == 0
|
||||
c2.load()
|
||||
assert c2.queue == -2
|
||||
|
||||
d.sched.unburyCardsForDeck(type="siblings")
|
||||
d.sched.unburyCardsForDeck( # pylint: disable=unexpected-keyword-arg
|
||||
type="siblings"
|
||||
)
|
||||
c2.load()
|
||||
assert c2.queue == 0
|
||||
|
||||
d.sched.buryCards([c.id, c2.id])
|
||||
d.sched.unburyCardsForDeck(type="all")
|
||||
d.sched.unburyCardsForDeck(type="all") # pylint: disable=unexpected-keyword-arg
|
||||
|
||||
d.reset()
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@ MAKEFLAGS += --warn-undefined-variables
|
|||
MAKEFLAGS += --no-builtin-rules
|
||||
.SUFFIXES:
|
||||
|
||||
BLACKARGS := -t py36 aqt tests --exclude='aqt/forms|buildinfo'
|
||||
ISORTARGS := aqt tests
|
||||
BLACKARGS := -t py36 aqt tests setup.py --exclude='aqt/forms|buildinfo'
|
||||
ISORTARGS := aqt tests setup.py
|
||||
|
||||
$(shell mkdir -p .build ../dist)
|
||||
|
||||
|
@ -78,7 +78,7 @@ CHECKDEPS := $(shell find aqt tests -name '*.py')
|
|||
@touch $@
|
||||
|
||||
.build/lint: $(CHECKDEPS)
|
||||
pylint -j 0 --rcfile=.pylintrc -f colorized --extension-pkg-whitelist=PyQt5,ankirspy aqt
|
||||
pylint -j 0 --rcfile=.pylintrc -f colorized --extension-pkg-whitelist=PyQt5,ankirspy aqt tests setup.py
|
||||
@touch $@
|
||||
|
||||
.build/imports: $(CHECKDEPS)
|
||||
|
|
27
qt/setup.py
27
qt/setup.py
|
@ -1,15 +1,19 @@
|
|||
import setuptools, sys, os
|
||||
import os
|
||||
|
||||
import setuptools
|
||||
|
||||
with open("../meta/version") as fh:
|
||||
version = fh.read().strip()
|
||||
|
||||
|
||||
def package_files(directory):
|
||||
entries = []
|
||||
for (path, directories, filenames) in os.walk(directory):
|
||||
entries.append((path, [os.path.join(path, f) for f in filenames]))
|
||||
return entries
|
||||
|
||||
extra_files = package_files('aqt_data')
|
||||
|
||||
extra_files = package_files("aqt_data")
|
||||
|
||||
setuptools.setup(
|
||||
name="aqt",
|
||||
|
@ -21,17 +25,16 @@ setuptools.setup(
|
|||
url="https://apps.ankiweb.net",
|
||||
packages=setuptools.find_packages(".", exclude=["tests"]),
|
||||
data_files=extra_files,
|
||||
classifiers=[
|
||||
],
|
||||
python_requires='>=3.6',
|
||||
classifiers=[],
|
||||
python_requires=">=3.6",
|
||||
install_requires=[
|
||||
'beautifulsoup4',
|
||||
'requests',
|
||||
'send2trash',
|
||||
'pyaudio',
|
||||
'markdown',
|
||||
'jsonschema',
|
||||
"beautifulsoup4",
|
||||
"requests",
|
||||
"send2trash",
|
||||
"pyaudio",
|
||||
"markdown",
|
||||
"jsonschema",
|
||||
'psutil; sys.platform == "win32"',
|
||||
'pywin32; sys.platform == "win32"',
|
||||
]
|
||||
],
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue