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
|
- docker
|
||||||
|
|
||||||
python:
|
python:
|
||||||
|
- "2.7"
|
||||||
- "3.7"
|
- "3.7"
|
||||||
|
|
||||||
before_install:
|
before_install:
|
||||||
|
|
|
@ -129,8 +129,12 @@ class ClientTestCase(TestCase):
|
||||||
self.assertEqual(result, b'<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n<test/>')
|
self.assertEqual(result, b'<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n<test/>')
|
||||||
|
|
||||||
def test_parse_is_dir_response_directory(self):
|
def test_parse_is_dir_response_directory(self):
|
||||||
|
try:
|
||||||
f = open('./tests/response_dir.xml', encoding='utf-8')
|
f = open('./tests/response_dir.xml', encoding='utf-8')
|
||||||
content = f.read()
|
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'
|
path = '/test_dir'
|
||||||
hostname = 'https://webdav.yandex.ru'
|
hostname = 'https://webdav.yandex.ru'
|
||||||
result = utils.parse_is_dir_response(content, path, hostname)
|
result = utils.parse_is_dir_response(content, path, hostname)
|
||||||
|
|
|
@ -2,15 +2,14 @@
|
||||||
|
|
||||||
import functools
|
import functools
|
||||||
import logging
|
import logging
|
||||||
|
import lxml.etree as etree
|
||||||
import os
|
import os
|
||||||
|
import requests
|
||||||
import shutil
|
import shutil
|
||||||
import threading
|
import threading
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from re import sub
|
from re import sub
|
||||||
|
|
||||||
import lxml.etree as etree
|
|
||||||
import requests
|
|
||||||
|
|
||||||
from webdav3.connection import *
|
from webdav3.connection import *
|
||||||
from webdav3.exceptions import *
|
from webdav3.exceptions import *
|
||||||
from webdav3.urn import Urn
|
from webdav3.urn import Urn
|
||||||
|
@ -977,8 +976,6 @@ class WebDavXmlUtils:
|
||||||
"""
|
"""
|
||||||
prefix = urlparse(hostname).path
|
prefix = urlparse(hostname).path
|
||||||
try:
|
try:
|
||||||
if isinstance(content, str):
|
|
||||||
content = content.encode('utf-8')
|
|
||||||
tree = etree.fromstring(content)
|
tree = etree.fromstring(content)
|
||||||
responses = tree.findall("{DAV:}response")
|
responses = tree.findall("{DAV:}response")
|
||||||
n_path = Urn.normalize_path(path)
|
n_path = Urn.normalize_path(path)
|
||||||
|
|
Loading…
Add table
Reference in a new issue