mirror of https://github.com/tqdm/tqdm.git
test:cleanup pytest config
This commit is contained in:
parent
b5742d824f
commit
31367d0a7a
4
Makefile
4
Makefile
|
@ -69,7 +69,7 @@ testperf:
|
|||
pytest -k tests_perf
|
||||
|
||||
testtimer:
|
||||
pytest --durations=10
|
||||
pytest
|
||||
|
||||
# another performance test, to check evolution across commits
|
||||
testasv:
|
||||
|
@ -116,7 +116,7 @@ pre-commit:
|
|||
# quick sanity checks
|
||||
@make --no-print-directory testsetup
|
||||
flake8 -j 8 --count --statistics setup.py .meta/ tqdm/ tests/ examples/
|
||||
pytest -qq -k "basic_overhead or not (perf or keras or pandas or monitoring)"
|
||||
pytest -qq --durations=1 -k "basic_overhead or not (perf or keras or pandas or monitoring)"
|
||||
prebuildclean:
|
||||
@+python -c "import shutil; shutil.rmtree('build', True)"
|
||||
@+python -c "import shutil; shutil.rmtree('dist', True)"
|
||||
|
|
|
@ -16,10 +16,9 @@ split_before_named_assigns=False
|
|||
split_before_closing_bracket=False
|
||||
|
||||
[tool:pytest]
|
||||
python_files = tests_*.py
|
||||
testpaths = tests
|
||||
addopts = -v --tb=short
|
||||
usefixtures = pretest_posttest
|
||||
python_files=tests_*.py
|
||||
testpaths=tests
|
||||
addopts=-v --tb=short -rxs --durations=0 --durations-min=0.1
|
||||
|
||||
[metadata]
|
||||
name = tqdm
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
import sys
|
||||
from tqdm import tqdm
|
||||
from pytest import fixture
|
||||
|
||||
|
||||
@fixture(autouse=True)
|
||||
def pretest_posttest():
|
||||
"""Fixture for all tests ensuring environment cleanup"""
|
||||
try:
|
||||
sys.setswitchinterval(1)
|
||||
except AttributeError:
|
||||
sys.setcheckinterval(100) # deprecated
|
||||
|
||||
if getattr(tqdm, "_instances", False):
|
||||
n = len(tqdm._instances)
|
||||
if n:
|
||||
tqdm._instances.clear()
|
||||
raise EnvironmentError(
|
||||
"{0} `tqdm` instances still in existence PRE-test".format(n))
|
||||
yield
|
||||
if getattr(tqdm, "_instances", False):
|
||||
n = len(tqdm._instances)
|
||||
if n:
|
||||
tqdm._instances.clear()
|
||||
raise EnvironmentError(
|
||||
"{0} `tqdm` instances still in existence POST-test".format(n))
|
|
@ -6,7 +6,6 @@ import asyncio
|
|||
from pytest import mark
|
||||
|
||||
from tqdm.asyncio import tqdm_asyncio, tarange
|
||||
from .tests_tqdm import pretest_posttest # NOQA, pylint: disable=unused-import
|
||||
from .tests_tqdm import StringIO, closing
|
||||
|
||||
tqdm = partial(tqdm_asyncio, miniters=0, mininterval=0)
|
||||
|
|
|
@ -6,7 +6,6 @@ from warnings import catch_warnings
|
|||
from pytest import mark
|
||||
|
||||
from tqdm.contrib.concurrent import thread_map, process_map
|
||||
from .tests_tqdm import pretest_posttest # NOQA, pylint: disable=unused-import
|
||||
from .tests_tqdm import importorskip, skip, StringIO, closing
|
||||
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ Tests for `tqdm.contrib`.
|
|||
import sys
|
||||
|
||||
from tqdm.contrib import tenumerate, tzip, tmap
|
||||
from .tests_tqdm import pretest_posttest # NOQA, pylint: disable=unused-import
|
||||
from .tests_tqdm import importorskip, StringIO, closing
|
||||
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ Tests for `tqdm.contrib.itertools`.
|
|||
import itertools
|
||||
|
||||
from tqdm.contrib.itertools import product
|
||||
from .tests_tqdm import pretest_posttest # NOQA, pylint: disable=unused-import
|
||||
from .tests_tqdm import StringIO, closing
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
from __future__ import division
|
||||
|
||||
from tqdm import tqdm
|
||||
from .tests_tqdm import pretest_posttest # NOQA, pylint: disable=unused-import
|
||||
from .tests_tqdm import importorskip, StringIO, closing
|
||||
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@ import subprocess
|
|||
|
||||
from tqdm.cli import main, TqdmKeyError, TqdmTypeError
|
||||
from tqdm.utils import IS_WIN
|
||||
from .tests_tqdm import pretest_posttest # NOQA, pylint: disable=unused-import
|
||||
from .tests_tqdm import skip, _range, closing, UnicodeIO, StringIO, BytesIO
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
from tqdm.notebook import tqdm as tqdm_notebook
|
||||
from .tests_tqdm import pretest_posttest # NOQA, pylint: disable=unused-import
|
||||
|
||||
|
||||
def test_notebook_disabled_description():
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
from tqdm import tqdm
|
||||
from .tests_tqdm import pretest_posttest # NOQA, pylint: disable=unused-import
|
||||
from .tests_tqdm import importorskip, skip, StringIO, closing
|
||||
|
||||
random = importorskip("numpy.random")
|
||||
|
|
|
@ -11,7 +11,6 @@ except ImportError:
|
|||
import sys
|
||||
|
||||
from tqdm import tqdm, trange
|
||||
from .tests_tqdm import pretest_posttest # NOQA, pylint: disable=unused-import
|
||||
from .tests_tqdm import importorskip, skip, StringIO, closing, _range, \
|
||||
patch_lock
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ import sys
|
|||
|
||||
from tqdm import tqdm, trange, TMonitor
|
||||
from .tests_perf import retry_on_except
|
||||
from .tests_tqdm import pretest_posttest # NOQA, pylint: disable=unused-import
|
||||
from .tests_tqdm import importorskip, skip, StringIO, closing, patch_lock
|
||||
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ import os
|
|||
from functools import wraps
|
||||
from contextlib import contextmanager
|
||||
from pytest import raises as assert_raises
|
||||
from pytest import fixture, importorskip, skip
|
||||
from pytest import importorskip, skip
|
||||
from warnings import catch_warnings, simplefilter
|
||||
|
||||
from tqdm import tqdm
|
||||
|
@ -118,29 +118,6 @@ def cpu_timify(t, timer=None):
|
|||
return timer
|
||||
|
||||
|
||||
@fixture(autouse=True)
|
||||
def pretest_posttest():
|
||||
"""Fixture for all tests ensuring environment cleanup"""
|
||||
try:
|
||||
sys.setswitchinterval(1)
|
||||
except AttributeError:
|
||||
sys.setcheckinterval(100) # deprecated
|
||||
|
||||
if getattr(tqdm, "_instances", False):
|
||||
n = len(tqdm._instances)
|
||||
if n:
|
||||
tqdm._instances.clear()
|
||||
raise EnvironmentError(
|
||||
"{0} `tqdm` instances still in existence PRE-test".format(n))
|
||||
yield
|
||||
if getattr(tqdm, "_instances", False):
|
||||
n = len(tqdm._instances)
|
||||
if n:
|
||||
tqdm._instances.clear()
|
||||
raise EnvironmentError(
|
||||
"{0} `tqdm` instances still in existence POST-test".format(n))
|
||||
|
||||
|
||||
class UnicodeIO(IOBase):
|
||||
"""Unicode version of StringIO"""
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
from ast import literal_eval
|
||||
import re
|
||||
|
||||
from .tests_tqdm import pretest_posttest # NOQA, pylint: disable=unused-import
|
||||
|
||||
|
||||
def test_version():
|
||||
"""Test version string"""
|
||||
|
|
4
tox.ini
4
tox.ini
|
@ -26,7 +26,7 @@ deps =
|
|||
{[coverage]deps}
|
||||
codecov
|
||||
commands =
|
||||
pytest --durations=10 --cov=tqdm --cov-report=xml --cov-report=term -k "not tests_perf"
|
||||
pytest --cov=tqdm --cov-report=xml --cov-report=term -k "not tests_perf"
|
||||
- coveralls
|
||||
codecov
|
||||
- codacy report -r coverage.xml
|
||||
|
@ -57,7 +57,7 @@ deps = {[extra]deps}
|
|||
|
||||
[testenv:perf]
|
||||
deps = pytest
|
||||
commands = pytest --durations=0 -k tests_perf
|
||||
commands = pytest -k tests_perf
|
||||
|
||||
[testenv:flake8]
|
||||
deps = flake8
|
||||
|
|
Loading…
Reference in New Issue