1052 Commits

Author SHA1 Message Date
Steve Kowalik
20c97e83d3 Remove use of mock
Since Python 3.4, the unittest module has provided mock, negating the
need for the external dependancy. Switch to using unittest.mock.

Change-Id: Idec3aaed2fddd1ece3ed86ee0bcc48f7616d56fa
2022-05-24 11:56:35 +10:00
Pavel Abalikhin
95f68cd673 Add timeout for Swift service
Connection class has timeout parameter but SwiftService and shell don't use it.
That can lead to an endless wait when network is unreachable.

Change-Id: Iafa42fc2f8b56feefa2bc8ea6a1b8845717d3bab
4.0.0
2022-04-21 18:00:27 +03:00
Stephen Finucane
20d837a276 Remove unnecessary unicode prefixes
All strings are unicode by default in Python 3. No need to mark them as
such.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: I68fb60ef271abfddebcc9d2137424f5db2a17e92
2022-03-21 18:32:30 +00:00
Stephen Finucane
61ce5ac824 Remove unnecessary object subclassing
All classes subclass from object by default in Python 3.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: I5a1ad57bcc092861ce969759b06a07c880ad3d35
2022-03-21 18:32:00 +00:00
Stephen Finucane
fa137a5bf1 Remove six
This mostly affects tests. Nothing too complicated

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: Iabc78f651e1d48db35638280722f8019798eccd6
2022-03-21 18:31:10 +00:00
Stephen Finucane
4983b90983 Remove coding comments
Everything is unicode in Python 3.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: I6a076dc67c461f265ed99878e3959e1992a88189
2022-03-21 18:29:25 +00:00
Stephen Finucane
3d10744c55 Remove __future__ imports
These aren't needed in modern Python 3 versions.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: I5e81d6fb2e2cb8e4bfae4ed746da002f44e871c4
2022-03-21 18:29:25 +00:00
Aarni Koskela
c09621eb42 Don't patch Requests globally on import
This also upgrades the Requests dependency to 2.4+ (released in 2014)
to avoid having to do version comparisons altogether.

Refs https://bugs.launchpad.net/python-swiftclient/+bug/1904551

Signed-off-by: Aarni Koskela <akx@iki.fi>
Change-Id: I58399f6c526b0b78462f31739c43076314ba9e76
2022-03-21 08:05:54 -07:00
Stephen Finucane
2636965f38 Drop support for Python 2
There's a lot of cleanup possible, but this is a start.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: Ia1176b7fd5434d52070d482a37abfbb98800cdb3
2022-03-16 15:06:19 -07:00
22a05b2039 Add Python3 zed unit tests
This is an automatically generated patch to ensure unit testing
is in place for all the of the tested runtimes for zed.

See also the PTI in governance [1].

[1]: https://governance.openstack.org/tc/reference/project-testing-interface.html

Change-Id: Ia832ebda47bb798876edf3c013e9b9a583405c11
2022-03-14 15:20:49 -07:00
Tim Burke
00f5b89227 CI: Drop swiftclient-swift-functional-py2 job
It got busted somewhere between 2022-01-15 and 2022-02-11; looks like
needing to override devstack to install on bionic finally caught up with
us. ;-)

FWIW, it fails down in stack.sh while trying to pip install grpcio:

   commands.CommandError: We expect a missing `_needs_stub` attribute
   from older versions of setuptools. Consider upgrading setuptools.

Change-Id: Iff9094e9dd7a3d0bcdb0dee3b08fa5b61c9186d0
2022-03-09 16:50:51 -08:00
c2d4fc7054 Update master for stable/yoga
Add file to the reno documentation build to show release notes for
stable/yoga.

Use pbr instruction to increment the minor version number
automatically so that master versions are higher than the versions on
stable/yoga.

Sem-Ver: feature
Change-Id: I55d45e6f076974a3b44ab8b26adbccef26373f85
2022-03-07 17:03:55 -08:00
PAPAMICA
4989d94663 Fix copy.py example.
Change-Id: Id2a58a085f58b0bf17eda636593bb482d614c245
2022-01-12 10:19:50 +01:00
Zuul
3f5d5b0252 Merge "Include storage policy when listing account with --long" 2021-10-13 01:11:03 +00:00
Zuul
ec6a346afb Merge "Allow functional tests to pass with etag_quoter enabled by default" 2021-09-24 02:35:55 +00:00
Zuul
e03a11c649 Merge "Allow unit tests to be run via pytest" 2021-09-23 23:56:23 +00:00
Tim Burke
373fa26ce1 Correctly aggregate totals for >10k items
Previously, we would write out totals for every page of listings, like

    $ swift list sync --prefix=09-21 --total -l
     80000000000
     80000000000
     80000000000
     58096000000

Now, roll those all into a single total:

    $ swift list sync --prefix=09-21 --total -l
    298096000000

Change-Id: Icc265636815220e33e8c9eec0a3ab80e9f899038
2021-09-21 16:06:56 -07:00
Tim Burke
ad3e8e49d0 Include storage policy when listing account with --long
Change-Id: Ibc2f9445b5a8e80cfb73d0706e20a7e4c62eec4a
2021-09-21 08:40:45 -07:00
Tim Burke
5129b33505 Only log the traceback for non-404s
Change-Id: I08ba4a3120e99b444b13f1ca6f5493529868df26
2021-09-20 15:49:59 -07:00
Tim Burke
553e34ebfe Improve formatting for billions of objects
Change-Id: If8aa08c4c8c8ad6ca2c861602baf1eefa8642a8a
2021-09-20 15:49:59 -07:00
bcf19d47a3 Add Python3 yoga unit tests
This is an automatically generated patch to ensure unit testing
is in place for all the of the tested runtimes for yoga.

See also the PTI in governance [1].

[1]: https://governance.openstack.org/tc/reference/project-testing-interface.html

Change-Id: Icf192aedeadf7fbed6e0f217da5b348172dc4478
2021-09-16 08:51:57 -07:00
218676a990 Update master for stable/xena
Add file to the reno documentation build to show release notes for
stable/xena.

Use pbr instruction to increment the minor version number
automatically so that master versions are higher than the versions on
stable/xena.

Sem-Ver: feature
Change-Id: I79a7fbda1ea9ae034d009c54be4b401809183c42
2021-09-16 08:51:57 -07:00
jinyuanliu
afa2c4642a Clean up extra spaces
Although these errors are not important, they affect the code specification.

Change-Id: Ifab29d9c803a78ee994b99b4b410893864b90908
2021-09-15 01:55:48 -04:00
wu.shiming
b846071d2f Changed minversion in tox to 3.18.0
The patch bumps min version of tox to 3.18.0 in order to
replace tox's whitelist_externals by allowlist_externals option:
https://github.com/tox-dev/tox/blob/master/docs/changelog.rst#v3180-2020-07-23

Change-Id: I244d98bb3fc7cb75624b598f4d26f784159f5428
2021-07-06 16:15:55 +08:00
Tim Burke
abda44a87d Use upper-constraints for docs jobs
Looks like there are some issues with too-new-Sphinx and the PDF docs
builds.

Also, get devstack installing on bionic again for our py2 func test job.

Change-Id: I633398054694fe6ba1e0de50278f274daf69fefd
2021-05-25 12:20:23 -07:00
Tim Burke
6d8138ebcf Allow functional tests to pass with etag_quoter enabled by default
Change-Id: I861b5e0a172f0ea0a5b1fe8389cd70da8d4b5d5d
2021-05-11 13:42:47 -07:00
Tim Burke
99b5b81217 Allow unit tests to be run via pytest
You can run all tests by just running

   $ pytest

Or just unit tests with

   $ pytest test/unit/

Or one specific test with

   $ pytest test/unit/test_swiftclient.py::TestConnection::test_reauth

Change-Id: I1dfa239f9ee9ea85663b5c1f22631a97f87b4dfc
2021-05-11 13:34:35 -07:00
Zuul
38c435f888 Merge "setup.cfg: Replace dashes with underscores" xena-em 2021-05-06 08:14:07 +00:00
Zuul
22e2605367 Merge "Use py3 as the default runtime for tox" 2021-05-06 04:59:58 +00:00
yangyawei
2beddc2f30 setup.cfg: Replace dashes with underscores
Setuptools v54.1.0 introduces a warning that the use of dash-separated
options in 'setup.cfg' will not be supported in a future version [1].
Get ahead of the issue by replacing the dashes with underscores. Without
this, we see 'UserWarning' messages like the following on new enough
versions of setuptools:

  UserWarning: Usage of dash-separated 'description-file' will not be
  supported in future versions. Please use the underscore name
  'description_file' instead

[1] https://github.com/pypa/setuptools/commit/a2e9ae4cb

Change-Id: Ief2c7a217914dc5cacdffc6959ed0585fc6a1225
2021-05-03 10:51:40 +08:00
jonasdlindner
58f0700ad9 Fix Typo in shell.py
Change-Id: I2615e0d6b54d8cc020c24d1b5b4064e038f0934b
2021-04-29 17:39:28 +02:00
zhangboye
998bb8b578 Use py3 as the default runtime for tox
Moving on py3 as the default runtime for tox to avoid to update
this at each new cycle.

Change-Id: I4a54455e7e8b1b4de2f9656d13f65ef090da68eb
2021-04-20 15:11:06 +08:00
Zuul
eaf40510fa Merge "Add Python3 xena unit tests" 2021-03-26 05:02:29 +00:00
6966fbea57 Add Python3 xena unit tests
This is an automatically generated patch to ensure unit testing
is in place for all the of the tested runtimes for xena.

See also the PTI in governance [1].

[1]: https://governance.openstack.org/tc/reference/project-testing-interface.html

Change-Id: Ic272b2583f9e0ff5f1b542ce9596af9d3bf8edef
2021-03-22 11:59:41 -07:00
c8b48dee58 Update master for stable/wallaby
Add file to the reno documentation build to show release notes for
stable/wallaby.

Use pbr instruction to increment the minor version number
automatically so that master versions are higher than the versions on
stable/wallaby.

Sem-Ver: feature
Change-Id: Idcc50c36c1fac81ed214bcbaf6a97307e3db7ee7
2021-03-22 11:59:01 -07:00
Tim Burke
06b36ae0e2 Drop lower-constraints testing
The OpenStack community consensus seems to be that it's not worth the
hassle of fixing. *Maybe* we can revisit this if we ever drop py2
support?

Reasonable spot to start on ML threads:
http://lists.openstack.org/pipermail/openstack-discuss/2021-January/019672.html

Change-Id: Ibf0c891782afe014cc453b713a94c187340d172e
Depends-On: https://review.opendev.org/c/openstack/requirements/+/777025
wallaby-em
2021-02-22 16:05:25 -08:00
zhangboye
e6876361f0 remove unicode from code
Change-Id: I791cc993aef832b30c08fdb5bdd7165a074d263f
2021-01-03 16:44:32 +08:00
Zuul
903e0cb64a Merge "Make py39 voting" 2020-11-03 04:49:23 +00:00
Tim Burke
a5aebc3b9a Make py39 voting
Also, add trove classifier for py39.

Depends-On: https://review.opendev.org/#/c/758813/
Change-Id: I8d33b4dd6af990b09141acd52d36e44e9c871b3b
2020-10-19 11:08:23 -07:00
Tim Burke
74c50dee2d Have delete --all imply --versions for the CLI
Change-Id: Id5a6d4cef3d4ed76c897a099a62a4ba3ed8f8dab
2020-10-16 13:57:02 -07:00
Zuul
fcd8488ec4 Merge "Remove some py38 job cruft" 2020-10-16 08:36:48 +00:00
Zuul
bf862981a6 Merge "Close connections created when calling module-level functions" 2020-10-15 22:41:10 +00:00
Tim Burke
de5c74069e Remove some py38 job cruft
For a time, we wanted to flag it as being voting while it still wasn't
voting for most of OpenStack. It's not needed now, though.

Change-Id: Idccb731a0814335fc4d314eed5caa1f336212b22
2020-10-15 11:45:55 -07:00
Zuul
90c10fab43 Merge "tests: Make test_delete_container_versions less flakey" 2020-10-14 03:56:46 +00:00
Tim Burke
97aa3e6541 Close connections created when calling module-level functions
Co-Authored-By: Clay Gerrard <clay.gerrard@gmail.com>
Change-Id: Id62e63afc6f2ffa32eb8640787c78559481050f9
Related-Change: I200ad0cdc8b7999c3f5521b9a822122bd18714bf
Related-Bug: #1873435
Closes-Bug: #1838775
2020-10-13 10:45:07 -07:00
Zuul
89994a7ad0 Merge "Add cacert test config option" 2020-09-23 22:14:55 +00:00
Zuul
ef7380048e Merge "Add Python3 wallaby unit tests" 2020-09-23 20:53:19 +00:00
Zuul
b5dd9caeb0 Merge "Update master for stable/victoria" 2020-09-23 20:35:49 +00:00
Zuul
d63ec1b38d Merge "Include transaction ID in ClientException.__str__" 2020-09-22 01:56:50 +00:00
Zuul
2c28691f86 Merge "[goal] Migrate testing to ubuntu focal" 2020-09-22 01:28:48 +00:00