diff --git a/setup.cfg b/setup.cfg index 8637b38d..e3f1e2f5 100644 --- a/setup.cfg +++ b/setup.cfg @@ -77,6 +77,7 @@ setup_requires=setuptools>=42; setuptools_scm[toml]>=3.4 python_requires=>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.* install_requires= colorama; platform_system == 'Windows' + importlib_resources; python_version < "3.7" tests_require=tox include_package_data=True packages=find: diff --git a/tests/tests_tqdm.py b/tests/tests_tqdm.py index b70146fe..bba457aa 100644 --- a/tests/tests_tqdm.py +++ b/tests/tests_tqdm.py @@ -1987,9 +1987,9 @@ def test_reversed(capsys): def test_contains(capsys): """Test __contains__ doesn't iterate""" - with tqdm(_range(9)) as t: + with tqdm(list(range(9))) as t: assert 9 not in t - assert all(i in t for i in range(9)) + assert all(i in t for i in _range(9)) out, err = capsys.readouterr() assert not out assert ' 0%' in err diff --git a/tqdm/cli.py b/tqdm/cli.py index 02653b2c..6cf24d43 100644 --- a/tqdm/cli.py +++ b/tqdm/cli.py @@ -245,15 +245,15 @@ Options: if manpath or comppath: from os import path from shutil import copyfile - try: - from importlib import resources - except ImportError: # py<3.9 + try: # py<3.7 import importlib_resources as resources + except ImportError: + from importlib import resources def cp(name, dst): """copy resource `name` to `dst`""" with resources.path('tqdm', name) as src: - copyfile(src, dst) + copyfile(str(src), dst) log.info("written:%s", dst) if manpath is not None: cp('tqdm.1', path.join(manpath, 'tqdm.1'))