pytest-dev / py

Python development support library (note: maintenance only)
MIT License
67 stars 106 forks source link

LocalPath.make_numbered_dir() doesn't handle unicode #182

Closed whimboo closed 2 years ago

whimboo commented 6 years ago

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

RonnyPfannschmidt commented 2 years ago

closing as wontfix, pytest has tmp_path now