Support Python 2.7 in tests

This commit is contained in:
Evgeny Ezhov 2019-11-27 21:30:57 +03:00
parent dc7d908462
commit fe3296f203
3 changed files with 9 additions and 7 deletions

View file

@ -129,8 +129,12 @@ class ClientTestCase(TestCase):
self.assertEqual(result, b'<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n<test/>')
def test_parse_is_dir_response_directory(self):
f = open('./tests/response_dir.xml', encoding='utf-8')
content = f.read()
try:
f = open('./tests/response_dir.xml', encoding='utf-8')
content = f.read().encode('utf-8')
except:
f = open('./tests/response_dir.xml')
content = f.read().decode('utf-8').encode('utf-8')
path = '/test_dir'
hostname = 'https://webdav.yandex.ru'
result = utils.parse_is_dir_response(content, path, hostname)