pytest-dev / py

Python development support library (note: maintenance only)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

LocalPath.make_numbered_dir() doesn't handle unicode

whimboo opened this issue · comments

The method LocalPath.make_numbered_dir() doesn't correctly handle unicode strings:

def test_tmpdir_unicode(tmpdir_factory):
    tmpdir = tmpdir_factory.mktemp(u'Хенрик')

It fails with:

src = str(udir)
E UnicodeEncodeError: 'ascii' codec can't encode characters in position 85-90: ordinal not in range(128)

Using fspath(udir) fixes it:
https://github.com/pytest-dev/py/blob/master/py/_path/local.py#L944

closing as wontfix, pytest has tmp_path now