isort tests; black/isort should notice changes to tests
This commit is contained in:
parent
5bb8d317ee
commit
3f0b4ff3f6
12
Makefile
12
Makefile
@ -8,6 +8,7 @@ RUNARGS :=
|
||||
.SUFFIXES:
|
||||
BLACKARGS := -t py36 anki aqt tests
|
||||
RUSTARGS := --release --strip
|
||||
ISORTARGS := anki aqt tests
|
||||
|
||||
$(shell mkdir -p .build)
|
||||
|
||||
@ -162,12 +163,13 @@ fix: fix-py-fmt fix-py-imports fix-rs-fmt fix-ts-fmt
|
||||
######################
|
||||
|
||||
PYCHECKDEPS := $(BUILDDEPS) .build/py-check-reqs $(shell find anki aqt -name '*.py' | grep -v buildhash.py)
|
||||
PYTESTDEPS := $(wildcard tests/*.py)
|
||||
|
||||
.build/py-mypy: $(PYCHECKDEPS)
|
||||
mypy anki aqt
|
||||
@touch $@
|
||||
|
||||
.build/py-test: $(PYCHECKDEPS) $(wildcard tests/*.py)
|
||||
.build/py-test: $(PYCHECKDEPS) $(PYTESTDEPS)
|
||||
./tools/tests.sh
|
||||
@touch $@
|
||||
|
||||
@ -175,11 +177,11 @@ PYCHECKDEPS := $(BUILDDEPS) .build/py-check-reqs $(shell find anki aqt -name '*.
|
||||
pylint -j 0 --rcfile=.pylintrc -f colorized --extension-pkg-whitelist=PyQt5,_ankirs anki aqt
|
||||
@touch $@
|
||||
|
||||
.build/py-imports: $(PYCHECKDEPS)
|
||||
isort anki aqt --check # if this fails, run 'make fix-py-imports'
|
||||
.build/py-imports: $(PYCHECKDEPS) $(PYTESTDEPS)
|
||||
isort $(ISORTARGS) --check # if this fails, run 'make fix-py-imports'
|
||||
@touch $@
|
||||
|
||||
.build/py-fmt: $(PYCHECKDEPS)
|
||||
.build/py-fmt: $(PYCHECKDEPS) $(PYTESTDEPS)
|
||||
black --check $(BLACKARGS) # if this fails, run 'make fix-py-fmt'
|
||||
@touch $@
|
||||
|
||||
@ -193,7 +195,7 @@ py-fmt: .build/py-fmt
|
||||
.PHONY: fix-py-imports fix-py-fmt
|
||||
|
||||
fix-py-imports:
|
||||
isort anki aqt
|
||||
isort $(ISORTARGS)
|
||||
|
||||
fix-py-fmt:
|
||||
black $(BLACKARGS) anki aqt
|
||||
|
@ -1,4 +1,7 @@
|
||||
import tempfile, os, shutil
|
||||
import os
|
||||
import shutil
|
||||
import tempfile
|
||||
|
||||
from anki import Collection as aopen
|
||||
|
||||
|
||||
|
@ -1,7 +1,8 @@
|
||||
import os.path
|
||||
from mock import MagicMock
|
||||
from tempfile import TemporaryDirectory
|
||||
from zipfile import ZipFile
|
||||
|
||||
from mock import MagicMock
|
||||
from nose2.tools.such import helper
|
||||
|
||||
from aqt.addons import AddonManager
|
||||
|
@ -1,12 +1,12 @@
|
||||
# coding: utf-8
|
||||
|
||||
import os, tempfile
|
||||
|
||||
from anki.utils import isWin
|
||||
from tests.shared import assertException, getEmptyCol
|
||||
from anki.stdmodels import addBasicModel, models
|
||||
import os
|
||||
import tempfile
|
||||
|
||||
from anki import Collection as aopen
|
||||
from anki.stdmodels import addBasicModel, models
|
||||
from anki.utils import isWin
|
||||
from tests.shared import assertException, getEmptyCol
|
||||
|
||||
|
||||
def test_create_open():
|
||||
|
@ -1,12 +1,14 @@
|
||||
# coding: utf-8
|
||||
|
||||
import os, tempfile
|
||||
import os
|
||||
import tempfile
|
||||
|
||||
from nose2.tools.decorators import with_setup
|
||||
|
||||
from anki import Collection as aopen
|
||||
from anki.exporting import *
|
||||
from anki.importing import Anki2Importer
|
||||
|
||||
from .shared import getEmptyCol
|
||||
|
||||
deck = None
|
||||
|
@ -1,15 +1,16 @@
|
||||
# coding: utf-8
|
||||
|
||||
import os
|
||||
from tests.shared import getUpgradeDeckPath, getEmptyCol
|
||||
from anki.utils import ids2str
|
||||
|
||||
from anki.importing import (
|
||||
Anki2Importer,
|
||||
TextImporter,
|
||||
SupermemoXmlImporter,
|
||||
MnemosyneImporter,
|
||||
AnkiPackageImporter,
|
||||
MnemosyneImporter,
|
||||
SupermemoXmlImporter,
|
||||
TextImporter,
|
||||
)
|
||||
from anki.utils import ids2str
|
||||
from tests.shared import getEmptyCol, getUpgradeDeckPath
|
||||
|
||||
testDir = os.path.dirname(__file__)
|
||||
|
||||
|
@ -1,11 +1,10 @@
|
||||
# coding: utf-8
|
||||
|
||||
import os
|
||||
|
||||
import shutil
|
||||
|
||||
from tests.shared import getEmptyCol
|
||||
from anki.utils import stripHTML
|
||||
from tests.shared import getEmptyCol
|
||||
|
||||
|
||||
def test_latex():
|
||||
|
@ -1,7 +1,7 @@
|
||||
# coding: utf-8
|
||||
|
||||
import tempfile
|
||||
import os
|
||||
import tempfile
|
||||
import time
|
||||
|
||||
from .shared import getEmptyCol, testDir
|
||||
|
@ -1,10 +1,10 @@
|
||||
# coding: utf-8
|
||||
import time
|
||||
|
||||
from tests.shared import getEmptyCol
|
||||
from anki.consts import MODEL_CLOZE
|
||||
from anki.utils import stripHTML, joinFields, isWin
|
||||
import anki.template
|
||||
from anki.consts import MODEL_CLOZE
|
||||
from anki.utils import isWin, joinFields, stripHTML
|
||||
from tests.shared import getEmptyCol
|
||||
|
||||
|
||||
def test_modelDelete():
|
||||
|
@ -1,12 +1,12 @@
|
||||
# coding: utf-8
|
||||
|
||||
import time
|
||||
import copy
|
||||
import time
|
||||
|
||||
from anki.consts import STARTING_FACTOR
|
||||
from tests.shared import getEmptyCol as getEmptyColOrig
|
||||
from anki.utils import intTime
|
||||
from anki.hooks import addHook
|
||||
from anki.utils import intTime
|
||||
from tests.shared import getEmptyCol as getEmptyColOrig
|
||||
|
||||
|
||||
def getEmptyCol():
|
||||
|
@ -1,12 +1,12 @@
|
||||
# coding: utf-8
|
||||
|
||||
import time
|
||||
import copy
|
||||
import time
|
||||
|
||||
from anki.consts import STARTING_FACTOR
|
||||
from tests.shared import getEmptyCol
|
||||
from anki.utils import intTime
|
||||
from anki.hooks import addHook
|
||||
from anki.utils import intTime
|
||||
from tests.shared import getEmptyCol
|
||||
|
||||
# Between 2-4AM, shift the time back so test assumptions hold.
|
||||
lt = time.localtime()
|
||||
|
@ -1,9 +1,10 @@
|
||||
# coding: utf-8
|
||||
|
||||
import os
|
||||
from tests.shared import getEmptyCol
|
||||
import tempfile
|
||||
|
||||
from tests.shared import getEmptyCol
|
||||
|
||||
|
||||
def test_stats():
|
||||
d = getEmptyCol()
|
||||
@ -27,6 +28,7 @@ def test_graphs_empty():
|
||||
|
||||
def test_graphs():
|
||||
from anki import Collection as aopen
|
||||
|
||||
dir = tempfile.gettempdir()
|
||||
|
||||
d = aopen(os.path.join(dir, "test.anki2"))
|
||||
|
@ -1,8 +1,9 @@
|
||||
# coding: utf-8
|
||||
|
||||
import time
|
||||
from tests.shared import getEmptyCol
|
||||
|
||||
from anki.consts import *
|
||||
from tests.shared import getEmptyCol
|
||||
|
||||
|
||||
def test_op():
|
||||
|
Loading…
Reference in New Issue
Block a user