Main version of Python is updated up to 3.7

And small style fixes
This commit is contained in:
Evgeny Ezhov 2019-10-06 18:27:45 +03:00
parent da46592c6f
commit d4edab9044
4 changed files with 19 additions and 13 deletions

View file

@ -1,6 +1,6 @@
language: python language: python
python: python:
- "2.7" - "3.7"
install: install:
- python setup.py develop - python setup.py develop
script: script:

View file

@ -10,6 +10,8 @@ But uses `requests` instead of `PyCURL`
Release Notes Release Notes
============= =============
**Version 0.13 TBD**
* Main version of Python is updated up to 3.7
**Version 0.12 - 21.06.2019** **Version 0.12 - 21.06.2019**
* Added depth argument in copy method in client.py by https://github.com/JesperHakansson * Added depth argument in copy method in client.py by https://github.com/JesperHakansson

View file

@ -49,7 +49,8 @@ setup(
requires=['python (>= 2.7.6)'], requires=['python (>= 2.7.6)'],
install_requires=['requests', 'lxml', 'argcomplete'], install_requires=['requests', 'lxml', 'argcomplete'],
scripts=['wdc'], scripts=['wdc'],
tests_require=['pytest', 'pyhamcrest', 'junit-xml', 'pytest-allure-adaptor'], test_suite='tests',
tests_require=['pytest'],
cmdclass={'install': Install, 'test': Test}, cmdclass={'install': Install, 'test': Test},
description='WebDAV client, based on original package https://github.com/designerror/webdav-client-python but ' description='WebDAV client, based on original package https://github.com/designerror/webdav-client-python but '
'uses requests instead of PyCURL', 'uses requests instead of PyCURL',
@ -73,6 +74,9 @@ setup(
'Programming Language :: Python :: 3.2', 'Programming Language :: Python :: 3.2',
'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Topic :: Internet', 'Topic :: Internet',
'Topic :: Software Development :: Libraries :: Python Modules', 'Topic :: Software Development :: Libraries :: Python Modules',
], ],

View file

@ -24,7 +24,7 @@ class ClientTestCase(TestCase):
def test_create_free_space_request_content(self): def test_create_free_space_request_content(self):
result = utils.create_free_space_request_content() result = utils.create_free_space_request_content()
self.assertEqual(result, b'<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n<propfind xmlns="DAV:"><prop>' self.assertEqual(result, b'<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n<propfind xmlns="DAV:"><prop>'
b'<quota-available-bytes/><quota-used-bytes/></prop></propfind>') b'<quota-available-bytes/><quota-used-bytes/></prop></propfind>')
def test_parse_free_space_response(self): def test_parse_free_space_response(self):
content = '<?xml version="1.0" encoding="utf-8"?><d:multistatus xmlns:d="DAV:"><d:response><d:href>/</d:href>' \ content = '<?xml version="1.0" encoding="utf-8"?><d:multistatus xmlns:d="DAV:"><d:response><d:href>/</d:href>' \
@ -55,7 +55,7 @@ class ClientTestCase(TestCase):
} }
result = utils.create_get_property_request_content(option=option, ) result = utils.create_get_property_request_content(option=option, )
self.assertEqual(result, b'<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n<propfind xmlns="DAV:"><prop>' self.assertEqual(result, b'<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n<propfind xmlns="DAV:"><prop>'
b'<aProperty xmlns="test"/></prop></propfind>') b'<aProperty xmlns="test"/></prop></propfind>')
def test_create_get_property_request_content_name_only(self): def test_create_get_property_request_content_name_only(self):
option = { option = {
@ -63,7 +63,7 @@ class ClientTestCase(TestCase):
} }
result = utils.create_get_property_request_content(option=option) result = utils.create_get_property_request_content(option=option)
self.assertEqual(result, b'<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n<propfind xmlns="DAV:"><prop>' self.assertEqual(result, b'<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n<propfind xmlns="DAV:"><prop>'
b'<aProperty xmlns=""/></prop></propfind>') b'<aProperty xmlns=""/></prop></propfind>')
def test_parse_get_property_response(self): def test_parse_get_property_response(self):
content = '<?xml version="1.0" encoding="utf-8"?><d:multistatus xmlns:d="DAV:"><d:response>' \ content = '<?xml version="1.0" encoding="utf-8"?><d:multistatus xmlns:d="DAV:"><d:response>' \
@ -81,7 +81,7 @@ class ClientTestCase(TestCase):
} }
result = utils.create_set_property_batch_request_content(options=[option]) result = utils.create_set_property_batch_request_content(options=[option])
self.assertEqual(result, b'<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n<propertyupdate xmlns="DAV:"><set><prop>' self.assertEqual(result, b'<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n<propertyupdate xmlns="DAV:"><set><prop>'
b'<aProperty xmlns="test">aValue</aProperty></prop></set></propertyupdate>') b'<aProperty xmlns="test">aValue</aProperty></prop></set></propertyupdate>')
def test_create_set_one_property_request_content_name_only(self): def test_create_set_one_property_request_content_name_only(self):
option = { option = {
@ -89,7 +89,7 @@ class ClientTestCase(TestCase):
} }
result = utils.create_set_property_batch_request_content(options=[option]) result = utils.create_set_property_batch_request_content(options=[option])
self.assertEqual(result, b'<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n<propertyupdate xmlns="DAV:"><set><prop>' self.assertEqual(result, b'<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n<propertyupdate xmlns="DAV:"><set><prop>'
b'<aProperty xmlns=""></aProperty></prop></set></propertyupdate>') b'<aProperty xmlns=""></aProperty></prop></set></propertyupdate>')
def test_create_set_property_batch_request_content(self): def test_create_set_property_batch_request_content(self):
options = [ options = [
@ -106,8 +106,8 @@ class ClientTestCase(TestCase):
] ]
result = utils.create_set_property_batch_request_content(options=options) result = utils.create_set_property_batch_request_content(options=options)
self.assertEqual(result, b'<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n<propertyupdate xmlns="DAV:"><set><prop>' self.assertEqual(result, b'<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n<propertyupdate xmlns="DAV:"><set><prop>'
b'<aProperty xmlns="test">aValue</aProperty><aProperty2 xmlns="test2">aValue2' b'<aProperty xmlns="test">aValue</aProperty><aProperty2 xmlns="test2">aValue2'
b'</aProperty2></prop></set></propertyupdate>') b'</aProperty2></prop></set></propertyupdate>')
def test_create_set_property_batch_request_content_name_only(self): def test_create_set_property_batch_request_content_name_only(self):
options = [ options = [
@ -120,8 +120,8 @@ class ClientTestCase(TestCase):
] ]
result = utils.create_set_property_batch_request_content(options=options) result = utils.create_set_property_batch_request_content(options=options)
self.assertEqual(result, b'<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n<propertyupdate xmlns="DAV:"><set><prop>' self.assertEqual(result, b'<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n<propertyupdate xmlns="DAV:"><set><prop>'
b'<aProperty xmlns=""></aProperty><aProperty2 xmlns=""></aProperty2></prop></set>' b'<aProperty xmlns=""></aProperty><aProperty2 xmlns=""></aProperty2></prop></set>'
b'</propertyupdate>') b'</propertyupdate>')
def test_etree_to_string(self): def test_etree_to_string(self):
tree = ElementTree(Element('test')) tree = ElementTree(Element('test'))
@ -175,10 +175,10 @@ class ClientTestCase(TestCase):
'</d:response></d:multistatus>' '</d:response></d:multistatus>'
path = '/test_dir' path = '/test_dir'
hostname = 'https://webdav.yandex.ru' hostname = 'https://webdav.yandex.ru'
result = utils.parse_is_dir_response(content.encode('utf-8'), path, hostname) result = utils.parse_is_dir_response(content, path, hostname)
self.assertTrue(result, 'It should be directory') self.assertTrue(result, 'It should be directory')
def test_parse_is_dir_response_directory(self): def test_parse_is_dir_response_file(self):
content = '<?xml version=\'1.0\' encoding=\'UTF-8\'?><d:multistatus xmlns:d="DAV:"><d:response><d:href>/test_' \ content = '<?xml version=\'1.0\' encoding=\'UTF-8\'?><d:multistatus xmlns:d="DAV:"><d:response><d:href>/test_' \
'dir/</d:href><d:propstat><d:status>HTTP/1.1 200 OK</d:status><d:prop><d:creationdate>2018-05-10T07' \ 'dir/</d:href><d:propstat><d:status>HTTP/1.1 200 OK</d:status><d:prop><d:creationdate>2018-05-10T07' \
':40:11Z</d:creationdate><d:displayname>test_dir</d:displayname><d:getlastmodified>Thu, 10 May 2018' \ ':40:11Z</d:creationdate><d:displayname>test_dir</d:displayname><d:getlastmodified>Thu, 10 May 2018' \