summaryrefslogtreecommitdiff
path: root/taskflow/test.py
Commit message (Collapse)AuthorAgeFilesLines
* Remove sixTakashi Kajinami2022-05-181-2/+1
| | | | | | | | This library no longer supports Python 2, thus usage of six can be removed. This also removes workaround about pickle library used in Python 2 only. Change-Id: I19d298cf0f402d65f0b142dea0bf35cf992332a9
* Use unittest.mock instead of mockHervé Beraud2021-04-271-1/+1
| | | | | | | | The mock third party library was needed for mock support in py2 runtimes. Since we now only support py36 and later, we can use the standard lib unittest.mock module instead. Change-Id: Ib169e3deb7ddb2bc93a206ebec4043552281aa7f
* Switch from unittest2 compat methods to Python 3.x methodsmelissaml2020-07-051-1/+1
| | | | | | | | | | | | | | | | | With the removal of Python 2.x we can remove the unittest2 compat wrappers and switch to assertCountEqual instead of assertItemsEqual We have been able to use them since then, because testtools required unittest2, which still included it. With testtools removing Python 2.7 support [3][4], we will lose support for assertItemsEqual, so we should switch to use assertCountEqual. [1] - https://bugs.python.org/issue17866 [2] - https://hg.python.org/cpython/rev/d9921cb6e3cd [3] - testing-cabal/testtools#286 [4] - testing-cabal/testtools#277 Change-Id: Iaa8251a1e9965a00fe99b7a740a104c011260340
* Stop to use the __future__ module.Hervé Beraud2020-06-021-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | The __future__ module [1] was used in this context to ensure compatibility between python 2 and python 3. We previously dropped the support of python 2.7 [2] and now we only support python 3 so we don't need to continue to use this module and the imports listed below. Imports commonly used and their related PEPs: - `division` is related to PEP 238 [3] - `print_function` is related to PEP 3105 [4] - `unicode_literals` is related to PEP 3112 [5] - `with_statement` is related to PEP 343 [6] - `absolute_import` is related to PEP 328 [7] [1] https://docs.python.org/3/library/__future__.html [2] https://governance.openstack.org/tc/goals/selected/ussuri/drop-py27.html [3] https://www.python.org/dev/peps/pep-0238 [4] https://www.python.org/dev/peps/pep-3105 [5] https://www.python.org/dev/peps/pep-3112 [6] https://www.python.org/dev/peps/pep-0343 [7] https://www.python.org/dev/peps/pep-0328 Change-Id: Ie7c18f2f1b6294e3d19c36112d35f4472ce77e7b
* Replace assertRaisesRegexp with assertRaisesRegexVu Cong Tuan2017-06-031-2/+2
| | | | | | | | | | assertRaisesRegexp was renamed to assertRaisesRegex in Py3.2 For more details, please check: https://docs.python.org/3/library/ unittest.html#unittest.TestCase.assertRaisesRegex Change-Id: I89cce19e80b04074aab9f49a76c7652acace78b3 Closes-Bug: #1436957
* Stop using oslotest.mockpatchChangBo Guo(gcb)2017-04-281-5/+4
| | | | | | This module has been deprecated in favor of native fixtures. Change-Id: I40ed7360091fea51a257807035e923c85602949f
* Always used the library packaged mockJoshua Harlow2016-05-101-13/+1
| | | | | | | | | | The library packaged mock seems to work better across python versions, so instead of trying to mix the system one and the library one always prefer the library one (which should work in all supported python versions). Change-Id: Id6ada69df9961a6b7511316e2f75ef9ee5f0b72b
* Add and use a new simple helper logging moduleJoshua Harlow2014-12-081-0/+2
| | | | | | | | | Add a new logging BLATHER level to easily allow its usage for messages that are below the normal DEBUG level such as compilation information and scope lookup info which can be very verbose in logs if always enabled. Change-Id: I828211403bd02bfd6777b10cdcfe58fb0637a52c
* Use the mock that finds a working implementationJoshua Harlow2014-10-181-0/+7
| | | | | | | | | | | | | | | | Instead of using the library provided mock, use the import logic in our tests module that tries to find the best one that is usable in the current environment. It appears that this logic is *still* needed due to bugs in the non-bundled mock that causes errors/exceptions such as: AttributeError: 'method-wrapper' object has no attribute '__module__' It seems this is related to (or is this same) upstream bug: - https://code.google.com/p/mock/issues/detail?id=234 Change-Id: Ifeb3017f43b7d34af155ceca35d040706d34b185
* Add a more dynamic/useful logging listenerJoshua Harlow2014-09-281-0/+69
| | | | | | | | | | | | | | | | | | | | Both cinder and glance are starting to share the same logic for there engine notification listener, so instead of having them copy around that code it will be much nicer if taskflow can just provide itself a more capable listener that both can share and use directly. This avoids users of taskflow having to understand more about the internals of taskflow and its associated state then they likely need to understand (which makes taskflow easier to use and less work to integrate). Relevant locations where this already exists: - https://github.com/openstack/cinder/blob/master/cinder/flow_utils.py - https://review.openstack.org/#/c/85211/ Change-Id: I98eeb180b31bd488ae0eadd730e1530d7bae1f1f
* Use the features that the oslotest mock base class providesJoshua Harlow2014-09-271-13/+11
| | | | | | | | | | | | Instead of having our own mock subclass that has similar functions as the oslotest base mocking class just use the base class functions where we can and add on our own customizations as we choose to. This change moves to using the base classes fixtures and also adjusts the customized subclass method names to match closer to the rest of the unittest classes method name style (camel-case not underscores). Change-Id: If24530c0381d7fb99797acaa582d3be1d7054185
* Use oslotest to provide our base test case classJoshua Harlow2014-09-271-3/+10
| | | | | | | | | | | | | | | | The oslotest library has a nice openstack testing integrated base class that can ensure we setup our base test case using the right logging fixtures, test timeouts, and output fixtures that better operate in the openstack ecosystem. This will also allow us to remove some of the functionality that we currently have in our base test case and replace it with the equivalent (or better) functionality that oslotest now provides. Part of blueprint use-oslo-test Change-Id: I1602d5180ec8649a1899185972750ddddf65990f
* Enabled hacking checks H305 and H307Christian Berendt2014-07-171-4/+2
| | | | | | | * H305 imports not grouped correctly * H307 like imports should be grouped together Change-Id: If1dd9c89f65ede6959865a885777cb08c263eca0
* Upgrade hacking version and fix some of the issuesJoshua Harlow2014-06-131-9/+15
| | | | | | | | | | | | | | | | | Update hacking to the new requirements version and fix about half of the new reported issues. The other hacking issues are for now ignored until fixed by adjusting our tox.ini file. This commit fixes the following new hacking errors: H405 - multi line docstring summary not separated with an empty line E265 - block comment should start with '# ' F402 - import 'endpoint' from line 21 shadowed by loop variable Change-Id: I6bae61591fb988cc17fa79e21cb5f1508d22781c
* Revert "Move taskflow.utils.misc.Failure to its own module"Jeremy Stanley2014-03-311-5/+5
| | | | | | | | | | | | This reverts commit 42ca240e8157b840c298d14fbf478ae570376633 which was a breaking change in a library consumed by other OpenStack projects with no deprecation or backwards compatibility considerations. It was able to merge because openstack/taskflow is apparently not yet part of the integrated gate via the proposed I202f4809afd689155e2cc4a00fc704fd772a0e92 change. Change-Id: I96cf36dc317499df91e43502efc85221f8177395 Closes-Bug: #1300161
* Move taskflow.utils.misc.Failure to its own moduleIvan A. Melnikov2014-03-311-5/+5
| | | | | | | | | | Failure class is important part of TaskFlow API, so it should be more visible and accessible. Breaking change: any client that used taskflow.utils.misc.Failure should be updated. Change-Id: Ib30000c9246bbcb227b34dfb0aba4d0b950bf926
* Rewrite assertion for same elements in sequencesIvan A. Melnikov2014-03-221-6/+28
| | | | | | | | | | | | New version is able to compare sequences whith elements that are not hashable and cannot be compared (so that sorted() does not work). For that, a utility function that caluclates difference between two sequences was added. This function was also used in retry.ForEachBase. The assertion was also renamed to assertItemsEqual, which matches same assertion that was added in python 2.7. Change-Id: I2b1b811190e9dc51718e4ca17ffc5c9015c34dc4
* Flow smart revert with retry controllerAnastasia Karpinska2014-03-181-0/+7
| | | | | | | | | | | | | | | | | | | - Remove flow REVERTING state. Now flow can be running and reverting simultaneously. Until flow isn't finished it is in RUNNING state. - Add RETRYING state for the retry controller. - Implement smart revertion and flow retries and retries resumption. - Default retry controllers: Times, ForEach and ParameterizedForEach. - Example and unit tests. Implements: blueprint subgraph-execution Implements: blueprint reversion-strategies Implements: blueprint smart-revert Change-Id: Ifa600bcad1edf2910f02ac36783cd458afbd880c
* Add zookeeper job/jobboard implJoshua Harlow2014-02-241-0/+30
| | | | | | | | | | | | | | | | | Create a base implementation of a jobboard which serves as a place to post work to be done, a place to get notified of new work, and a place which can be used to atomically acquire that work (so that it can be worked on) as well as transfer that work from one entity (say when that entity fails) to another entity (for further resumption or other policy/code driven recovery processes). Implements: blueprint job-reference-impl Change-Id: I1de1525df0deee612fb14ca36f0415ea7d2f707c
* Merge "Run action-engine tests with worker-based engine"Jenkins2014-02-201-0/+32
|\
| * Run action-engine tests with worker-based engineStanislav Kudriashev2014-02-191-0/+32
| | | | | | | | Change-Id: I00398fd2387b261c577f5d3eba9e2aebae3ba165
* | Merge "Message-oriented worker-based flow with kombu"Jenkins2014-02-201-0/+50
|\ \ | |/
| * Message-oriented worker-based flow with kombuStanislav Kudriashev2014-02-191-0/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Implemented Worker to be started on remote host for handling tasks request. * Implemented WorkerTaskExecutor that proxies tasks requests to remote workers. * Implemented Proxy that is used for consuming and publishing messages by Worker and Executor. * Added worker-based engine and worker task executor. * Added kombu dependency to requirements. * Added worker-based flow example. * Added unit-tests for worker-based flow components. Implements: blueprint worker-based-engine Change-Id: I8c6859ba4a1a56c2592e3d67cdfb8968b13ee99c
* | Remove extraneous vim configuration commentsyangxurong2014-02-141-2/+0
|/ | | | | | | | | Remove line containing comment - # vim: tabstop=4 shiftwidth=4 softtabstop=4 Change-Id: I7581cc88b8de433d5609ed06c6570b0b45c13573 Closes-Bug:#1229324
* Engine tests refactoringIvan A. Melnikov2014-01-301-10/+14
| | | | | | | | | | | | This change makes tests from test_action_engine.py more focused and deterministic: - replace assertIsSubset with assertIsSuperAndSubsequence, which checks order, too; - remove all sleeping from test tasks, it does not help anything anyway; - refactor tests that verify behaviour in case of task failing in nested subflow. Change-Id: I87ce1e5eed4a3a93c3c6593b618e82cfdd68204f
* Capture task durationJoshua Harlow2013-12-091-0/+20
| | | | | | | | | | | Record how long a task took to execute (or fail) by adding a new listener (and associated refactoring) that can be used to record these time statistics in storage. blueprint capture-task-duration Change-Id: I9c556e5dcbad924380ae4b94ffb03bc22edad50a
* Fix up python 3.3 incompatabilitiesJoshua Harlow2013-11-211-7/+31
| | | | | | | | | | | | Make the python 3.3 testing work by selectively disabling & including eventlet, switch to testtools and testrepository which has 2.6, 2.7, 3.2+ unified testing support so that we can correctly run our tests in all supported python versions. Closes-Bug: #1251660 Co-authored-by: Alexander Gorodnev <agorodnev@griddynamics.com> Change-Id: I23b6f04387cfd3bf6b5a044edffa446ca897ce3a
* Add a flow flattening utilJoshua Harlow2013-09-201-0/+13
| | | | | | | | | | | | | | Instead of recursively executing subflows which causes dead locks when they parent and subflows share the same executor we can instead flatten the parent and subflows into a single graph, composed with only tasks and run this instead, which will not have the issue of subflows dead locking, since after flattening there is no concept of a subflow. Fixes bug: 1225759 Change-Id: I79b9b194cd81e36ce75ba34a673e3e9d3e96c4cd
* Move toward using a backend+connection modelJoshua Harlow2013-09-121-26/+0
| | | | | | | | | | | | | | | | | | Instead of having a pretty restrictive module based api for saving logbook objects it is much more friendly and extensible to move toward a more ceilometer-influenced engine and connection based storage backend using stevedore to do the backend loading instead of a custom registration/fetching mechanism. This allows us to provide a base object oriented backend api that can be easily inherited from to allow for customized & pluggable backend storage modules. Implements blueprint stevedore-based-backends Implements blueprint ceilometer-influenced-backends Change-Id: Ib5868d3d9018b7aa1a3354858dcb90ca1a04055d
* Use the same root test class.Joshua Harlow2013-08-261-0/+55
Instead of being strongly tied to unittest2 make it easier for taskflow to switch to another root class (testr?) by abstracting out the unittest2 usage. This also enables some useful functionality to exist in that root test class that other tasks can take advantage of. Change-Id: I381b6fb07e47f984b44cde439a17f39a1c1d32ac