summaryrefslogtreecommitdiff
path: root/tests/unit/test_multithreading.py
Commit message (Collapse)AuthorAgeFilesLines
* Rename "tests" directory to be "test" like in the swift repoTim Burke2019-11-061-240/+0
| | | | | | | | | | | | | In addition to being less confusing for devs, this lets us actually run tempauth tests in swiftclient dsvm jobs. The job definition (over in the swift repo) specifies test/sample.conf, which does not exist in this repo. As a result, those tests would skip with SKIPPING FUNCTIONAL TESTS DUE TO NO CONFIG Change-Id: I558dbf9a657d442e6e19468e543bbec855129eeb
* Drop testtools from test-requirements.txtTim Burke2016-02-121-3/+3
| | | | | | | | | | | My understanding is that it was mainly being used so we could have sane testing on py26. With py26 support being dropped, we no longer need it. Also drop discover from test-requirements.txt, as we don't seem to actually use it. Change-Id: Iee04c42890596d3b483c1473169480a3ae19aac8 Related-Change: I37116731db11449d0c374a6a83a3a43789a19d5f
* Miscellaneous (mostly test) cleanupTim Burke2015-10-071-9/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * Always use testtools.TestCase, since we're relying on testtools * Always use mock (as opposed to unittest.mock) since we're relying on mock * Add note about when a missing logging handler was added * Stop %-formatting the giant usage string that doesn't actually need any formatting * Prefer assertIs, assertIn, assertIsInstance over assertTrue * Use else-self.fail instead of sentinel values * Check resp.get('error') is None before checking resp['success'] is True, so test failures actually tell you something useful * Tighten some isinstance assertions * Import MockHttpTest from correct location * Only populate clean_os_environ once * Use setUp for setup, not __init__ * Replace assertIn(key, dict) and assertEqual(foo, dict[key]) with assertEqual(foo, dict.get(key)) when key is a literal and foo is not None * Use mock.patch.object instead of manually patching for tests * Use six.binary_type instead of type(''.encode('utf-8')) * Stop shadowing builtin bytes * Reclaim some margin * Stop checking the return-type of encode_utf8; we already know it's bytes Change-Id: I2138ea553378ce88810b7353147c8645a8f8c90e
* change deprecated assertEquals to assertEqualHiroshi Miura2015-08-061-3/+3
| | | | | | | | | | fix against H234: assertEquals() logs a DeprecationWarning in Python3.x. use assertEqual() instead. Closes-bug: #1480776 Change-Id: Iffda6bb5f2616d4af4567eeea37bb26531e34371 Signed-off-by: Hiroshi Miura <miurahr@nttdata.co.jp>
* Properly test raw writes in Python 3Tim Burke2015-07-071-17/+10
| | | | | | | | Previously we were trying to test writing bytes in Python 3 using only native (unicode) string objects. That doesn't test what we thought we were testing. Change-Id: I10a0a38143d7f7d850ab9a7005ad87f5d314c375
* Fix crash when stat'ing objects with non-ascii namesJoel Wright2015-02-171-1/+9
| | | | | | | | This patch fixes a crash and stack trace in stat when an object name contains non-ascii characters. Change-Id: Ib6dc686771e593243de56cafc100b17e51d9d9d5 Closes-Bug: 1411665
* This patch fixes downloading files to stdout.Joel Wright2015-01-231-10/+18
| | | | | | | | | | | | This patch fixes downloading files to stdout and modifies _SwiftReader to operate as an iterator that performs file checks at the end of iteration as well as a context manager. File verification checks have been removed from __exit__ and added to __iter__. Change-Id: I3250bdeeef8484a9122c4b5b854756a7c8f8731e Closes-Bug: 1395922 Closes-Bug: 1387376
* Add importable SwiftService incorporating shell.py logicJoel Wright2014-08-261-243/+134
| | | | | | | | | | | | | | | | This patch adds a SwiftService class that incorporates the high level logic from swiftclient/shell.py. It also ports shell.py to use the new class, and updates the code in swiftclient/multithreading.py to allow the SwiftService to be used for multiple operations whilst using only one thread pool. Currently, code that imports swiftclient has to have its own logic for things like creating large objects, parallel uploads, and parallel downloads. This patch adds a SwiftService class that makes that functionality available in Python code as well as through the shell. Change-Id: I08c5796b4c01001d79fd571651c3017c16462ffd Implements: blueprint bin-swift-logic-as-importable-library
* Remove testtools.main() call from testsChristian Schwede2014-05-201-4/+0
| | | | | | | | | | | | | 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
* Add functional tests for python-swiftclientChristian Schwede2014-05-051-0/+347
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