Closed yurivict closed 1 year ago
pathlib is an old version, now the current version is pathlib2.
The pathlib module is a standard library module. It's always installed in Python 3.4+ Recent versions of ubelt only support Python 3.6+, but older releases do support other older Python versions.
I use python-39 and the test depending on pathlib is skipped because it isn't available.
Something is wrong. The pathlib module should always be available on 3.9.
What is the result of:
python3 -c "import pathlib; print(pathlib.__file__)"
?
Oh, I think I see the problem now. The test_pathlib
test itself is bad.
def test_pathlib():
try:
import pathlib
base = pathlib.Path(ub.ensure_app_cache_dir('ubelt'))
dpath = base.joinpath('test_pathlib_mkdir')
# ensuredir
ub.delete(dpath)
assert not dpath.exists()
got = ub.ensuredir(dpath)
assert got.exists()
# shrinkuser
assert ub.shrinkuser(base) == '~/.cache/ubelt'
assert ub.augpath(base, prefix='foo') == '/home/joncrall/.cache/fooubelt'
ub.expandpath(base)
except Exception:
import pytest
pytest.skip('pathlib is not installed')
I hardcoded my machine name into it, and the exception catches anything. Changing that line to str(ub.Path('~/.cache/fooubelt').expand())
should work. This is a test from when ubelt still supported 2.7, which is why the try/except is there. It should just be removed now.
$ python3.9 -c "import pathlib; print(pathlib.__file__)"
/usr/local/lib/python3.9/pathlib.py
Describe the bug Some tests expect
pathlib
:but it isn't in requirements/tests.txt