352 Commits

Author SHA1 Message Date
Jenkins
3d0de79e26 Merge "change assertEquals to assertEqual" 2014-05-28 03:23:20 +00:00
Martin Geisler
a030734701 Use Emacs-friendly coding line.
To signal the file encoding to Emacs, one can add a line with

  -*- coding: your-favority-encoding -*-

Python also understands such a line, infact it also understands the
line if it says "encoding" instead of "coding".

However, it is only "coding" that has an effect in Emacs. Furthermore,
since "encoding" is not recognized, Emacs will prompt the user with a
scary looking message when the file is opened:

  The local variable list in __init__.py contains values that may not
  be safe.

Using the correct variable name fixes this.

(The file contain only ASCII characters at the moment, so the line
could alternatively be removed completely.)

Change-Id: Ie6b4f41043bf97bb59e3de403e4794c302d81783
2014-05-26 14:35:03 +02:00
Martin Geisler
b4d97079b6 Remove extra double quote from docstring
The extra " was visible on

  http://docs.openstack.org/developer/python-swiftclient/swiftclient.html

Change-Id: I7d61c8259a4f13464c11ae7e3fa28eb3a58e4baa
2014-05-26 11:30:23 +02:00
Jenkins
1d81933921 Merge "fixed several pep8 issues" 2014-05-24 10:17:15 +00:00
Jenkins
5e18d95cb2 Merge "Remove testtools.main() call from tests" 2014-05-24 09:16:59 +00:00
anc
eaf4fcbb8d Fix wrong assertions in unit tests
A couple of assertTrue in the test_swiftclient.py
unit tests should be assertEqual. Also, the expected
values now need to be bytes literals.

Change-Id: I7cc1bd60d9ba82d1a28fbae2e1243d3c799451bd
2014-05-22 16:56:31 +01:00
Christian Berendt
d08bd458be fixed several pep8 issues
* E111 indentation is not a multiple of four
  * E128 continuation line under-indented for visual indent
  * E265 block comment should start with '# '
  * E713 test for membership should be 'not in'

Tested with pep8 version 1.5.6 (2014-04-14).

Change-Id: I7f85c143d463c501a0df20724362ad5c0f2d4dde
2014-05-21 16:31:53 +00:00
Christian Schwede
258420f410 Fix Python3 bugs
This patch fixes three issues that were found running
functional tests with Python 3:

1. python-requests sets 'application/x-www-form-urlencoded' as
   content-type if the input is not a string object and no
   content-type is given.

2. Encoding of the headers is now only done if required. This
   prevents comparisons between unencoded headers and encoded
   prefixes and avoids unnecessary forloop-iterations.
   One unittest was extended to ensure it works for unencoded
   and encoded headers with or without the prefix.

3. Functional tests recently switched to using byte data for
   testing, thus the comparison needs to be a byte object as well.

Change-Id: I035f8b4b9c9ccdc79820b907770a48f86d0343b4
2.1.0
2014-05-21 14:54:18 +01:00
Christian Schwede
876238a134 Remove testtools.main() call from tests
There is no testtools.main() at all (this was a
unittest.main() before). Let's remove this unused
and non-working code.

The following code can be used if someone needs
to start tests manually:

    python -m unittest <test_file.py>

Change-Id: Id5162ac73825584df6c23dbe68786ff3355fc6ae
2014-05-20 14:54:41 +00:00
anc
e7dc854257 Move test_shell.py under tests/unit/
Looks like test_shell.py got left behind when
the unit tests were relocated under tests/unit.
As a consequence they weren't included in tox
runs.

Change-Id: I93435e6141c5e3ad4a9403626f226d7c760cbd7c
2014-05-20 11:21:11 +01:00
Jenkins
761ba3770b Merge "Mark swiftclient as being a universal wheel" 2014-05-16 20:54:25 +00:00
Jenkins
76c42a820c Merge "change assert_ to assertTrue" 2014-05-16 17:59:55 +00:00
Jenkins
09eb1843f1 Merge "fixed typos found by RETF rules" 2014-05-16 15:41:30 +00:00
Alex Gaynor
1b83af8141 Mark swiftclient as being a universal wheel
Change-Id: I9580ab0f5bc53b472d0b633858090f9e0708ed90
2014-05-16 10:00:23 -04:00
Jenkins
1270cb2208 Merge "Provide a link to the documentation to the README" 2014-05-15 22:29:01 +00:00
Jenkins
fe5e8a7574 Merge "Declare that we support Python 3" 2014-05-15 20:12:45 +00:00
Christian Berendt
f58a1640a1 change assert_ to assertTrue
According to http://docs.python.org/2/library/unittest.html
assert_ is a deprecated alias of assertTrue.

Change-Id: I18db0af72934dde4498502fb29579941d020cf01
2014-05-14 21:15:07 +02:00
Christian Berendt
569bbc723e change assertEquals to assertEqual
According to http://docs.python.org/2/library/unittest.html
assertEquals is a deprecated alias of assertEqual.

Change-Id: Ibf4d548b86c53f30830b7e34b019fa8f67997cd8
2014-05-14 19:08:52 +02:00
Alex Gaynor
c2ea205314 Provide a link to the documentation to the README
Change-Id: I99a46860ffff93452904d24504a4ccc58e8e64c6
2014-05-13 09:33:47 -07:00
Jenkins
22badfd804 Merge "Add "." for help strings" 2014-05-13 04:44:56 +00:00
Christian Berendt
2d30656f41 fixed typos found by RETF rules
rules are avaialble at https://en.wikipedia.org/wiki/Wikipedia:AutoWikiBrowser/Typos

Change-Id: I98b6e46cb84962ffdac02e9007b5ad3b30bc2817
2014-05-12 12:02:32 +02:00
Chmouel Boudjnah
bc84d7c3fb Fix running the unittests under py3
Since we added the tests.functional the py3 tests wasn't running
properly fixing it with some voodoo testr magic.

Change-Id: Id301adb32ba739f05591c4c352e0cf7d87576755
2014-05-09 09:29:04 +02:00
Andreas Jaeger
9340122817 Add "." for help strings
The command descriptions did not include a "." at the end but the
argument description does. Add "." everywhere.

Also capitalize and add "." for parameter of capabilities.

Change-Id: I2355e0d0c38170d669c8e568361faf4b68203d16
2014-05-08 16:51:51 +02:00
Alex Gaynor
8b71670f15 Declare that we support Python 3
Note that this should not land until we figure out why `tox -e py33` doesn't
actually run any tests.

Change-Id: Id4e080cfbfca45b3bf7ed81b03a31414495a1348
2014-05-08 06:51:46 -07:00
Jenkins
3895d8535a Merge "Only encode metadata for user customed headers" 2014-05-08 12:21:48 +00:00
Alex Gaynor
30244399dd Make the function tests Python3-import friendly
Change-Id: Ic73fc2a6f6712505eda71fa2e2e91ac680ced9a3
2014-05-07 07:27:58 -07:00
Chmouel Boudjnah
4467d98f30 Only encode metadata for user customed headers
Don't encode standard headers keys but just the x-*-meta- ones. That
fixes py3 to not have them casted as bytes and not properly passed to
the requests kwargs.

Other trivial py3 fixes along the way.

Change-Id: I91b95f32fb2aec9b20892a5bb95fd1bc65d002f3
2014-05-07 12:11:14 +02:00
Jenkins
4e85183019 Merge "Add functional tests for python-swiftclient" 2014-05-06 13:25:00 +00:00
Christian Schwede
eb94ac076d Add functional tests for python-swiftclient
Coverage for swiftclient.client is 71% with these tests.

Unit tests have been moved into another subdirectory
to separate them from functional tests.

Change-Id: Ib8c4d78f7169cee893f82906f6388a5b06c45602
2014-05-05 11:53:37 +02:00
Jenkins
b1ca7056b1 Merge "Mock auth_end_time in test_shell.test_download" 2014-04-29 21:45:28 +00:00
Alex Gaynor
9ff3bad4e2 Removed a duplicate word in a dostring
Change-Id: I38e41a7ce9f91b5b1785491c6cd10dbbba9562a2
2014-04-25 11:26:28 -07:00
Chmouel Boudjnah
0fc27f6c28 Mock auth_end_time in test_shell.test_download
If we don't we are getting an error like this under py3:

TypeError: unsupported operand type(s) for /: 'float' and 'MagicMock'

Change-Id: If5a6947757297354e6b81fc45f011cc2921d609f
2014-04-25 12:11:51 +00:00
Chmouel Boudjnah
a99c2ff581 Don't utf8 encode urls.
This is not needed since already done by requests.

(and it was buggy with py3).

Change-Id: I9505c56be2f53eb8071aea3d5fb9d8caa9508e34
2014-04-24 17:05:36 +02:00
Jenkins
37bf0ff9a1 Merge "Fixed several shell tests on Python3." 2014-04-24 06:51:27 +00:00
Jenkins
b9bd897639 Merge "Fix up StringIO use in tests for py3" 2014-04-24 00:26:47 +00:00
Jenkins
fc66708418 Merge "Updated test_shell for Python3" 2014-04-23 23:18:50 +00:00
Alex Gaynor
c3bec04485 Fixed several shell tests on Python3.
They currently fail because on Python3 arbitrary objects cannot be compared, in
this case, MagicMock and int. In Python2 these comparisons silently pass.

Change-Id: I468c2137702a454365886099e827d329cb1d7209
2014-04-23 15:52:13 -07:00
Samuel Merritt
1353f2412b Fix up StringIO use in tests for py3
Some spots in this file were already referencing six.StringIO, but
some were still using StringIO.StringIO, which does not work on
py3. This patch just makes them all use six.StringIO and removes the
now-unused (and wrong, on py3) import.

Change-Id: I3c7311c3983f4eb409eedb6f85ede6ffe4059e63
2014-04-23 13:04:54 -07:00
Jenkins
1893cbec88 Merge "Fix test_raw_upload test" 2014-04-23 19:58:10 +00:00
Alex Gaynor
0102e2e1ee Updated test_shell for Python3
Change-Id: Ia76e544fa6e0a222c260191a1ab74939078ed2fb
2014-04-23 11:40:37 -07:00
Jenkins
91075c3251 Merge "Remove validate_headers" 2014-04-23 16:57:24 +00:00
Jenkins
fb2058f52b Merge "Use quote/unquote from six module for py3" 2014-04-23 16:57:23 +00:00
Jenkins
cda2573ab6 Merge "Add tests for bin/swift" 2014-04-18 02:28:27 +00:00
Chmouel Boudjnah
e2b7636d66 Fix test_raw_upload test
We were testing the test but we were not testing that we have actually
properly uploaded the object with the right content-len

(and it was broken under py3)

Change-Id: Ifa91c30532090cac9f8e18ff18eaf5e6c98737d1
2014-04-17 12:04:43 -04:00
Chmouel Boudjnah
504e5a7f53 Remove validate_headers
It wasn't used anymore since moved up to requests (and it fails in py3).

Change-Id: Ic8a80ae09ca6445696a9cf34ffb503c5ff51bc79
2014-04-17 12:04:43 -04:00
Chmouel Boudjnah
8830c81db7 Use quote/unquote from six module for py3
Change-Id: I42cff32fbf3febd6dd6a7171b9214f93b4414f9a
2014-04-17 12:04:43 -04:00
Tristan Cacqueray
fa20e7f685 Makes use of requests.Session
This allows better connection pooling and may improve performances.

Change-Id: I69e986b7387dd3ac281731b8355a3eec34a537f8
2014-04-16 16:00:17 +00:00
Jenkins
aaa563c749 Merge "Fix test_multithreading on Python 3" 2014-04-16 02:58:47 +00:00
Jenkins
c810772623 Merge "Fix swiftclient.client.quote() for Python 3" 2014-04-16 00:36:39 +00:00
Victor Stinner
ea498fb052 Fix test_multithreading on Python 3
* On Python 3, the printer doesn't encode Unicode to utf8 anymore, since
  print() expects a Unicode string.

* Update unit tests for Python 3 since repr() doesn't escape non-ASCII
  characters in Unicode strings anymore:
  http://legacy.python.org/dev/peps/pep-3138/

Change-Id: I89471019d691a46651312d6a49964b719192148a
2014-04-15 11:38:26 -04:00