From fd969bfd74c057be9947579f3c1343bc68fe796e Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Sun, 15 Nov 2020 21:57:29 +0000 Subject: [PATCH] mostly linting --- .github/workflows/test.yml | 10 ++++++---- Dockerfile | 2 +- tests/tests_main.py | 1 + tests/tests_perf.py | 10 +++++----- tox.ini | 2 +- tqdm/cli.py | 9 --------- 6 files changed, 14 insertions(+), 20 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 175bd208..8e7b5043 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -35,7 +35,7 @@ jobs: test: strategy: matrix: - python: [2.7, 3.5, 3.6, 3.7, 3.8, pypy2, pypy3] + python: [2.7, 3.4, 3.5, 3.6, 3.7, 3.8, pypy2, pypy3] name: py${{ matrix.python }} runs-on: ubuntu-latest steps: @@ -49,15 +49,17 @@ jobs: if [[ "$PYVER" == py* ]]; then tox -e $PYVER elif [[ "$PYVER" == "3.7" ]]; then - tox -e tf-no-keras + tox -e py${PYVER/./}-linux,tf-no-keras else - tox -e py${PYVER/./} + [[ "$PYVER" == *3.4 ]] && sed -i '/relative_files/d' .coveragerc + tox -e py${PYVER/./}-linux fi env: PYVER: ${{ matrix.python }} CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }} - - name: Coveralls Parallel + - if: ${{ matrix.python != 3.4 }} + name: Coveralls Parallel uses: AndreMiras/coveralls-python-action@develop with: parallel: true diff --git a/Dockerfile b/Dockerfile index de690907..96f9dc4e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ FROM python:3.7-alpine COPY dist/*.whl . -RUN pip install -U $(ls *.whl) && rm *.whl +RUN pip install -U $(ls ./*.whl) && rm ./*.whl ENTRYPOINT ["tqdm"] diff --git a/tests/tests_main.py b/tests/tests_main.py index 2301003f..15b8fa83 100644 --- a/tests/tests_main.py +++ b/tests/tests_main.py @@ -82,6 +82,7 @@ def test_main(): sys.stdin = [str(i).encode() for i in _range(N)] # with closing(UnicodeIO()) as fp: main(argv=['--log', 'DEBUG'], fp=NULL) + main(argv=['--log=DEBUG'], fp=NULL) # assert "DEBUG:" in sys.stdout.getvalue() try: diff --git a/tests/tests_perf.py b/tests/tests_perf.py index 51d918bf..61bef2e7 100644 --- a/tests/tests_perf.py +++ b/tests/tests_perf.py @@ -61,7 +61,7 @@ def relative_timer(): return spent -def retry_on_except(n=6, check_cpu_time=True): +def retry_on_except(n=3, check_cpu_time=True): """decroator for retrying `n` times before raising Exceptions""" def wrapper(func): """actual decorator""" @@ -249,7 +249,7 @@ def test_lock_args(): assert_performance(0.5, 'noblock', time_noblock(), 'tqdm', time_tqdm()) -@retry_on_except() +@retry_on_except(10) def test_iter_overhead_hard(): """Test overhead of iteration based tqdm (hard)""" @@ -273,7 +273,7 @@ def test_iter_overhead_hard(): assert_performance(130, 'trange', time_tqdm(), 'range', time_bench()) -@retry_on_except() +@retry_on_except(10) def test_manual_overhead_hard(): """Test overhead of manual tqdm (hard)""" @@ -297,7 +297,7 @@ def test_manual_overhead_hard(): assert_performance(130, 'tqdm', time_tqdm(), 'range', time_bench()) -@retry_on_except() +@retry_on_except(10) def test_iter_overhead_simplebar_hard(): """Test overhead of iteration based tqdm vs simple progress bar (hard)""" @@ -323,7 +323,7 @@ def test_iter_overhead_simplebar_hard(): 10, 'trange', time_tqdm(), 'simple_progress', time_bench()) -@retry_on_except() +@retry_on_except(10) def test_manual_overhead_simplebar_hard(): """Test overhead of manual tqdm vs simple progress bar (hard)""" diff --git a/tox.ini b/tox.ini index 97c83f01..be7c8dfb 100644 --- a/tox.ini +++ b/tox.ini @@ -5,7 +5,7 @@ [tox] # deprecation warning: py{26,32,33,34} -envlist = py{26,27,33,34,35,36,37,38,py2,py3}, tf-no-keras, perf, flake8, setup.py +envlist = py{26,27,33,34,35,36,37,38,py2,py3}{,-linux}, tf-no-keras, perf, flake8, setup.py [coverage] deps = diff --git a/tqdm/cli.py b/tqdm/cli.py index eba483e4..956e924c 100644 --- a/tqdm/cli.py +++ b/tqdm/cli.py @@ -38,15 +38,6 @@ def cast(val, typ): raise TqdmTypeError(val + ' : ' + typ) -def isBytes(val): - """Equivalent of `isinstance(val, six.binary_type)`.""" - try: - val.index(b'') - except TypeError: - return False - return True - - def posix_pipe(fin, fout, delim=b'\\n', buf_size=256, callback=lambda float: None, callback_len=True): """