pass unicode path to listdir to get back unicode filenames

This commit is contained in:
Alan Hamlett 2017-05-21 16:42:05 -07:00
parent 5fc0fdf067
commit e6e07a017d
3 changed files with 3 additions and 3 deletions

View file

@ -280,7 +280,7 @@ class ArgumentsTestCase(utils.TestCase):
self.patched['wakatime.packages.requests.adapters.HTTPAdapter.send'].return_value = response
with utils.TemporaryDirectory() as tempdir:
filename = list(filter(lambda x: x.endswith('.txt'), os.listdir('tests/samples/codefiles/unicode')))[0]
filename = list(filter(lambda x: x.endswith('.txt'), os.listdir(u('tests/samples/codefiles/unicode'))))[0]
entity = os.path.join('tests/samples/codefiles/unicode', filename)
shutil.copy(entity, os.path.join(tempdir, filename))
entity = os.path.realpath(os.path.join(tempdir, filename))

View file

@ -493,7 +493,7 @@ class MainTestCase(utils.TestCase):
self.patched['wakatime.packages.requests.adapters.HTTPAdapter.send'].return_value = response
with utils.TemporaryDirectory() as tempdir:
filename = list(filter(lambda x: x.endswith('.txt'), os.listdir('tests/samples/codefiles/unicode')))[0]
filename = list(filter(lambda x: x.endswith('.txt'), os.listdir(u('tests/samples/codefiles/unicode'))))[0]
entity = os.path.join('tests/samples/codefiles/unicode', filename)
shutil.copy(entity, os.path.join(tempdir, filename))
entity = os.path.realpath(os.path.join(tempdir, filename))

View file

@ -76,7 +76,7 @@ except ImportError:
return self.name
def __exit__(self, exc_type, exc_value, traceback):
shutil.rmtree(self.name)
shutil.rmtree(u(self.name))
class NamedTemporaryFile(object):