Support Python 2.7 in tests
This commit is contained in:
parent
dc7d908462
commit
fe3296f203
3 changed files with 9 additions and 7 deletions
|
@ -4,6 +4,7 @@ services:
|
|||
- docker
|
||||
|
||||
python:
|
||||
- "2.7"
|
||||
- "3.7"
|
||||
|
||||
before_install:
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -2,15 +2,14 @@
|
|||
|
||||
import functools
|
||||
import logging
|
||||
import lxml.etree as etree
|
||||
import os
|
||||
import requests
|
||||
import shutil
|
||||
import threading
|
||||
from io import BytesIO
|
||||
from re import sub
|
||||
|
||||
import lxml.etree as etree
|
||||
import requests
|
||||
|
||||
from webdav3.connection import *
|
||||
from webdav3.exceptions import *
|
||||
from webdav3.urn import Urn
|
||||
|
@ -977,8 +976,6 @@ class WebDavXmlUtils:
|
|||
"""
|
||||
prefix = urlparse(hostname).path
|
||||
try:
|
||||
if isinstance(content, str):
|
||||
content = content.encode('utf-8')
|
||||
tree = etree.fromstring(content)
|
||||
responses = tree.findall("{DAV:}response")
|
||||
n_path = Urn.normalize_path(path)
|
||||
|
|
Loading…
Add table
Reference in a new issue