summaryrefslogtreecommitdiffstats
path: root/tests/unit/test_importutils.py
Commit message (Collapse)AuthorAgeFilesLines
* Fix Copyright Headers - Rename LLC to FoundationDavanum Srinivas2013-03-111-1/+1
| | | | | | One code change, rest are in headers Change-Id: I73f59681358629e1ad74e49d3d3ca13fcb5c2eb1
* Replace direct use of testtools BaseTestCase.Monty Taylor2013-01-241-2/+2
| | | | | | | | | Using the BaseTestCase across the tests in the tree lets us put in log fixtures and consistently handle mox and stubout. Part of blueprint grizzly-testtools. Change-Id: Iba7eb2c63b0c514009b2c28e5930b27726a147b0
* Use testtools as test base class.Monty Taylor2013-01-241-2/+2
| | | | | | | | | | | | | On the path to testr migration, we need to replace the unittest base classes with testtools. Replace tearDown with addCleanup, addCleanup is more resilient than tearDown. The fixtures library has excellent support for managing and cleaning tempfiles. Use it. Replace skip_ with testtools.skipTest Part of blueprint grizzly-testtools. Change-Id: I45e11bbb1ff9b31f3278d3b016737dcb7850cd98
* Implement importutils.try_import.Dan Prince2013-01-141-0/+8
| | | | | | | | | | | | | | | | | | | | Adds a new (simple) importutils.try_import function which can return a module name or a default (by default this is None). This should help clean up some of our try: import foo except... blocks in modules. This commit also drops the dependency on python-extras which is no longer needed. Fixes LP Bug #1099501. Change-Id: I8591f79983bdad67a50d1aaae6dce8428dfce084
* fix bug lp:1019348,update openstack-common to support pep8 1.3.Yaguang Tang2012-07-181-2/+2
| | | | | | also,this patch turns off pep8 E125 check. Change-Id: I22d2a94d89530586d614af39af17ae542c5e0cbf
* add import_object_ns functionSean Dague2012-06-141-0/+43
| | | | | | | | | | | | | To support bp:virt-driver-cleanup, there is a desire to have shorter driver strings (i.e. libvirt.LibvirtDriver instead of nova.virt.libvirt.LibvirtDriver). One way to support this is with a new import_object variant that takes a namespace to load from. If the code fails to load the driver in the prefered namespace it will also try loading the full driver path, before throwing an exception. Change-Id: Ib97c92f38685ca89f29890f8015fc413acc744f8
* add more realistic unit tests for importutilsSean Dague2012-06-121-0/+20
| | | | | | | Add realistic tests including objects with and without args to importutils. Change-Id: If23db5ef80cdfa4be95e95b90e647ac2455fffc8
* Remove common.exception from common.importutils.Russell Bryant2012-05-021-2/+1
| | | | | | | | This patch removes the usage of common.exception from common.importutils. Instead of raising exception.NotFound() from importutils.import_class(), just use the built-in ImportError. Change-Id: I95e84908d1f80c5ca3bbac049eda8faa64212ae0
* Change behavior in utils.import_object().Russell Bryant2012-04-111-0/+49
Fix bug 972859. Prior to this patch, utils.import_object(foo) and utils.import_class(foo) would return the same thing if foo was the path to a class. This patch changes utils.import_object() to return an instance of the class, instead, also allowing you to pass in arguments to the constructor. This patch also removes the odd behavior of import_object() to be able to also import a module. Instead, a new function import_module() has been added. Finally, the three import helpers have been moved to a new module, importutils. Change-Id: Ia2ea64c965692f8c3a29adec332dd93a83980070