Hello community, here is the log from the commit of package python-oslotest for openSUSE:Factory checked in at 2014-09-28 19:54:19 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-oslotest (Old) and /work/SRC/openSUSE:Factory/.python-oslotest.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-oslotest" Changes: -------- --- /work/SRC/openSUSE:Factory/python-oslotest/python-oslotest.changes 2014-04-02 17:25:34.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.python-oslotest.new/python-oslotest.changes 2014-09-28 19:54:46.000000000 +0200 @@ -1,0 +2,43 @@ +Sat Sep 27 15:58:40 UTC 2014 - [email protected] + +- update to 1.1.0: + * no change compared to 1.1.0.0a2 + +------------------------------------------------------------------- +Tue Sep 16 07:14:53 UTC 2014 - [email protected] + +- update to 1.1.0.0a2: + * Add fixture for mock.patch.multiple + * Ensure that mock.patch.stopall is called last + * Remove differences between Python 2.x and 3.x versions + * Require six + * Add documentation for running oslo_debug_heler.sh + * Restructure oslotest docs + * Add pdb support to tox with debug helper shell script + * Updated from global requirements + * Cleaning up index.rst file + * Add known issue about time.time mocking + * Updated from global requirements + * Add API documentation + * Moving to use the mock module found in Python3 + +------------------------------------------------------------------- +Wed Sep 3 12:45:53 UTC 2014 - [email protected] + +- add drop-mox-dependency.diff + +------------------------------------------------------------------- +Tue Aug 26 10:02:12 UTC 2014 - [email protected] + +- update to 1.1.0.0a1: + * Update to hacking 0.9.2 + * Cleanup mock patches on BaseTestCase tearDown( + * Add unit test for olsotest base class + * fix .gitreview after rename + * Sync new sphinx requirement spec + * Set log level to default value + * Updated from global requirements + * Update cross-test directions + * Update project name in doc build + +------------------------------------------------------------------- Old: ---- oslotest-1.0.0.tar.gz New: ---- oslotest-1.1.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-oslotest.spec ++++++ --- /var/tmp/diff_new_pack.OAKHLa/_old 2014-09-28 19:54:47.000000000 +0200 +++ /var/tmp/diff_new_pack.OAKHLa/_new 2014-09-28 19:54:47.000000000 +0200 @@ -17,7 +17,7 @@ Name: python-oslotest -Version: 1.0.0 +Version: 1.1.0 Release: 0 Summary: OpenStack test framework License: Apache-2.0 @@ -29,15 +29,15 @@ # Test requirements: BuildRequires: python-fixtures >= 0.3.14 BuildRequires: python-mock >= 1.0 -BuildRequires: python-mox >= 0.5.3 +BuildRequires: python-mox3 >= 0.7.0 BuildRequires: python-python-subunit >= 0.0.18 BuildRequires: python-six BuildRequires: python-testrepository >= 0.0.18 BuildRequires: python-testscenarios >= 0.4 BuildRequires: python-testtools >= 0.9.34 Requires: python-fixtures >= 0.3.14 -Requires: python-mock >= 1.0 -Requires: python-mox >= 0.5.3 +Requires: python-mock >= 1 +Requires: python-mox3 >= 0.7.0 Requires: python-python-subunit >= 0.0.18 Requires: python-six Requires: python-testrepository >= 0.0.18 @@ -69,6 +69,7 @@ %files %defattr(-,root,root,-) %doc ChangeLog README.rst LICENSE AUTHORS +%{_bindir}/oslo_debug_helper.sh %{python_sitelib}/* %changelog ++++++ oslotest-1.0.0.tar.gz -> oslotest-1.1.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslotest-1.0.0/AUTHORS new/oslotest-1.1.0/AUTHORS --- old/oslotest-1.0.0/AUTHORS 2014-04-01 18:50:57.000000000 +0200 +++ new/oslotest-1.1.0/AUTHORS 2014-09-18 14:15:35.000000000 +0200 @@ -1 +1,31 @@ - +Alessio Ababilov <[email protected]> +Alexander Gorodnev <[email protected]> +Angus Salkeld <[email protected]> +Chang Bo Guo <[email protected]> +Christian Berendt <[email protected]> +Chuck Short <[email protected]> +Davanum Srinivas <[email protected]> +Dirk Mueller <[email protected]> +Doug Hellmann <[email protected]> +Doug Hellmann <[email protected]> +George Peristerakis <[email protected]> +Ihar Hrachyshka <[email protected]> +Ilya Pekelny <[email protected]> +Jason Kölker <[email protected]> +Jay Pipes <[email protected]> +Jeremy Stanley <[email protected]> +Joe Gordon <[email protected]> +Joe Heck <[email protected]> +Julien Danjou <[email protected]> +Luis A. Garcia <[email protected]> +Marc Koderer <[email protected]> +Mark McLoughlin <[email protected]> +Mauro S. M. Rodrigues <[email protected]> +Monty Taylor <[email protected]> +Noorul Islam K M <[email protected]> +Rajaram Mallya <[email protected]> +Sergey Kraynev <[email protected]> +Soren Hansen <[email protected]> +Steve Martinelli <[email protected]> +Yuriy Taraday <[email protected]> +Zhongyue Luo <[email protected]> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslotest-1.0.0/ChangeLog new/oslotest-1.1.0/ChangeLog --- old/oslotest-1.0.0/ChangeLog 2014-04-01 18:50:57.000000000 +0200 +++ new/oslotest-1.1.0/ChangeLog 2014-09-18 14:15:35.000000000 +0200 @@ -1,6 +1,36 @@ CHANGES ======= +1.1.0 +----- + +* Add fixture for mock.patch.multiple +* Ensure that mock.patch.stopall is called last +* Remove differences between Python 2.x and 3.x versions +* Require six +* Add documentation for running oslo_debug_heler.sh +* Restructure oslotest docs +* Add pdb support to tox with debug helper shell script +* Updated from global requirements +* Cleaning up index.rst file +* Add known issue about time.time mocking +* Updated from global requirements +* Add API documentation +* Moving to use the mock module found in Python3 + +1.1.0.0a1 +--------- + +* Update to hacking 0.9.2 +* Cleanup mock patches on BaseTestCase tearDown() +* Add unit test for olsotest base class +* fix .gitreview after rename +* Sync new sphinx requirement spec +* Set log level to default value +* Updated from global requirements +* Update cross-test directions +* Update project name in doc build + 1.0.0 ----- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslotest-1.0.0/PKG-INFO new/oslotest-1.1.0/PKG-INFO --- old/oslotest-1.0.0/PKG-INFO 2014-04-01 18:50:57.000000000 +0200 +++ new/oslotest-1.1.0/PKG-INFO 2014-09-18 14:15:36.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: oslotest -Version: 1.0.0 +Version: 1.1.0 Summary: OpenStack test framework Home-page: http://launchpad.net/oslo Author: OpenStack @@ -10,80 +10,12 @@ oslotest ========== - OpenStack test framework and test fixtures + OpenStack test framework and test fixtures. * Free software: Apache license * Documentation: http://docs.openstack.org/developer/oslotest - - Cross-testing With Other Projects - ================================= - - The oslotest package is cross-tested against its consuming projects to - ensure that no changes to the library break the tests in those other - projects. - - In the Gate - ----------- - - To add your project to the list for cross-testing, update - ``modules/openstack_project/files/jenkins_job_builder/config/projects.yaml`` - in the openstack-infra/config git repository and add sections like: - - :: - - - '{pipeline}-oslo.test-dsvm-{name}{branch-designator}': - pipeline: check - node: 'devstack-precise || devstack-precise-check' - branch-designator: '' - branch-override: default - - '{pipeline}-oslo.test-dsvm-{name}{branch-designator}': - pipeline: gate - node: devstack-precise - branch-designator: '' - branch-override: default - - to the ``jobs`` list for your project. Refer to - https://review.openstack.org/#/c/76381 for an example. - - Then update ``modules/openstack_project/files/zuul/layout.yaml`` by - adding the new check test to the global list of jobs (to make it - non-voting to start), and then to your project and to oslo.test. - - :: - - - name: check-oslo.test-dsvm-oslo.messaging - voting: false - - :: - - - name: openstack/oslo.messaging - ... - check: - ... - - check-oslo.test-dsvm-oslo.messaging - ... - - :: - - - name: openstack/oslo.test - ... - check: - ... - - check-oslo.test-dsvm-oslo.messaging - ... - - - Locally - ------- - - To run the cross-tests locally, invoke the script directly, passing - the path to the other source repository and the tox environment name - to use: - - :: - - $ cd oslo.test - $ ./tools/run_cross_tests.sh ~/repos/openstack/oslo.config py27 + * Source: http://git.openstack.org/cgit/openstack/oslotest + * Bugs: http://bugs.launchpad.net/oslo Platform: UNKNOWN diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslotest-1.0.0/README.rst new/oslotest-1.1.0/README.rst --- old/oslotest-1.0.0/README.rst 2014-04-01 18:50:31.000000000 +0200 +++ new/oslotest-1.1.0/README.rst 2014-09-18 14:15:05.000000000 +0200 @@ -2,77 +2,9 @@ oslotest ========== -OpenStack test framework and test fixtures +OpenStack test framework and test fixtures. * Free software: Apache license * Documentation: http://docs.openstack.org/developer/oslotest - -Cross-testing With Other Projects -================================= - -The oslotest package is cross-tested against its consuming projects to -ensure that no changes to the library break the tests in those other -projects. - -In the Gate ------------ - -To add your project to the list for cross-testing, update -``modules/openstack_project/files/jenkins_job_builder/config/projects.yaml`` -in the openstack-infra/config git repository and add sections like: - -:: - - - '{pipeline}-oslo.test-dsvm-{name}{branch-designator}': - pipeline: check - node: 'devstack-precise || devstack-precise-check' - branch-designator: '' - branch-override: default - - '{pipeline}-oslo.test-dsvm-{name}{branch-designator}': - pipeline: gate - node: devstack-precise - branch-designator: '' - branch-override: default - -to the ``jobs`` list for your project. Refer to -https://review.openstack.org/#/c/76381 for an example. - -Then update ``modules/openstack_project/files/zuul/layout.yaml`` by -adding the new check test to the global list of jobs (to make it -non-voting to start), and then to your project and to oslo.test. - -:: - - - name: check-oslo.test-dsvm-oslo.messaging - voting: false - -:: - - - name: openstack/oslo.messaging - ... - check: - ... - - check-oslo.test-dsvm-oslo.messaging - ... - -:: - - - name: openstack/oslo.test - ... - check: - ... - - check-oslo.test-dsvm-oslo.messaging - ... - - -Locally -------- - -To run the cross-tests locally, invoke the script directly, passing -the path to the other source repository and the tox environment name -to use: - -:: - - $ cd oslo.test - $ ./tools/run_cross_tests.sh ~/repos/openstack/oslo.config py27 +* Source: http://git.openstack.org/cgit/openstack/oslotest +* Bugs: http://bugs.launchpad.net/oslo diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslotest-1.0.0/doc/source/api.rst new/oslotest-1.1.0/doc/source/api.rst --- old/oslotest-1.0.0/doc/source/api.rst 1970-01-01 01:00:00.000000000 +0100 +++ new/oslotest-1.1.0/doc/source/api.rst 2014-09-18 14:15:05.000000000 +0200 @@ -0,0 +1,24 @@ +===== + API +===== + +oslotest.base +============= + +.. automodule:: oslotest.base + +.. autoclass:: oslotest.base.BaseTestCase + :members: + +oslotest.mockpatch +================== + +.. automodule:: oslotest.mockpatch + :members: + :special-members: + +oslotest.moxstubout +=================== + +.. automodule:: oslotest.moxstubout + :members: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslotest-1.0.0/doc/source/conf.py new/oslotest-1.1.0/doc/source/conf.py --- old/oslotest-1.0.0/doc/source/conf.py 2014-04-01 18:50:31.000000000 +0200 +++ new/oslotest-1.1.0/doc/source/conf.py 2014-09-18 14:15:05.000000000 +0200 @@ -37,7 +37,7 @@ master_doc = 'index' # General information about the project. -project = u'oslo.test' +project = u'oslotest' copyright = u'2014, OpenStack Foundation' # If true, '()' will be appended to :func: etc. cross-reference text. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslotest-1.0.0/doc/source/features.rst new/oslotest-1.1.0/doc/source/features.rst --- old/oslotest-1.0.0/doc/source/features.rst 1970-01-01 01:00:00.000000000 +0100 +++ new/oslotest-1.1.0/doc/source/features.rst 2014-09-18 14:15:05.000000000 +0200 @@ -0,0 +1,37 @@ +========== + Features +========== + +Debugging with oslo_debug_helper.sh +=================================== + +The oslotest package also distributes a shell file that may be used to assist +in debugging python code. The shell file uses testtools, and supports debugging +with `pdb <https://docs.python.org/2/library/pdb.html>`_. + +Adding breakpoints to the code +------------------------------ + +The typical usage to break into the debugger from a running program is to +insert: + +.. code-block:: python + + import pdb; pdb.set_trace() + +Update tox.ini +-------------- + +Within the ``tox.ini`` file of your project add the following:: + + [testenv:debug] + commands = oslo_debug_helper.sh {posargs} + +To run with tox: + +.. code-block:: bash + + $ tox -e debug + $ tox -e debug test_notifications + $ tox -e debug test_notifications.NotificationsTestCase + $ tox -e debug test_notifications.NotificationsTestCase.test_send_notification diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslotest-1.0.0/doc/source/index.rst new/oslotest-1.1.0/doc/source/index.rst --- old/oslotest-1.0.0/doc/source/index.rst 2014-04-01 18:50:31.000000000 +0200 +++ new/oslotest-1.1.0/doc/source/index.rst 2014-09-18 14:15:05.000000000 +0200 @@ -1,19 +1,18 @@ -.. documentation master file, created by - sphinx-quickstart on Tue Jul 9 22:26:36 2013. - You can adapt this file completely to your liking, but it should at least - contain the root `toctree` directive. +Welcome to oslotest's documentation! +==================================== -Welcome to oslo.test's documentation! -===================================== +OpenStack test framework and test fixtures. -Contents: +Contents +======== .. toctree:: :maxdepth: 2 - readme installation - usage + api + testing + features contributing Indices and tables diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslotest-1.0.0/doc/source/readme.rst new/oslotest-1.1.0/doc/source/readme.rst --- old/oslotest-1.0.0/doc/source/readme.rst 2014-04-01 18:50:31.000000000 +0200 +++ new/oslotest-1.1.0/doc/source/readme.rst 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -.. include:: ../../README.rst diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslotest-1.0.0/doc/source/testing.rst new/oslotest-1.1.0/doc/source/testing.rst --- old/oslotest-1.0.0/doc/source/testing.rst 1970-01-01 01:00:00.000000000 +0100 +++ new/oslotest-1.1.0/doc/source/testing.rst 2014-09-18 14:15:05.000000000 +0200 @@ -0,0 +1,30 @@ +========= + Testing +========= + +Cross-testing With Other Projects +================================= + +The oslotest package can be cross-tested against its consuming +projects to ensure that no changes to the library break the tests in +those other projects. + +In the Gate +----------- + +Refer to the instructions in +https://wiki.openstack.org/wiki/Oslo/UsingALibrary for setting up +cross-test jobs in the gate. + +Locally +------- + +To run the cross-tests locally, invoke the script directly, passing +the path to the other source repository and the tox environment name +to use: + +:: + + $ cd oslo.test + $ ./tools/run_cross_tests.sh ~/repos/openstack/oslo.config py27 + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslotest-1.0.0/doc/source/usage.rst new/oslotest-1.1.0/doc/source/usage.rst --- old/oslotest-1.0.0/doc/source/usage.rst 2014-04-01 18:50:31.000000000 +0200 +++ new/oslotest-1.1.0/doc/source/usage.rst 1970-01-01 01:00:00.000000000 +0100 @@ -1,13 +0,0 @@ -======== -Usage -======== - -To use in a project:: - - from oslotest import base - - - class MyTest(base.BaseTestCase): - - def test_something(self): - self.assertTrue(True) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslotest-1.0.0/oslotest/__init__.py new/oslotest-1.1.0/oslotest/__init__.py --- old/oslotest-1.0.0/oslotest/__init__.py 2014-04-01 18:50:31.000000000 +0200 +++ new/oslotest-1.1.0/oslotest/__init__.py 2014-09-18 14:15:05.000000000 +0200 @@ -11,4 +11,7 @@ # under the License. import six -six.add_move(six.MovedModule('mox', 'mox', 'mox3.mox')) + + +six.add_move(six.MovedModule('mock', 'mock', 'unittest.mock')) +six.add_move(six.MovedModule('mox', 'mox3.mox', 'mox3.mox')) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslotest-1.0.0/oslotest/base.py new/oslotest-1.1.0/oslotest/base.py --- old/oslotest-1.0.0/oslotest/base.py 2014-04-01 18:50:31.000000000 +0200 +++ new/oslotest-1.1.0/oslotest/base.py 2014-09-18 14:15:05.000000000 +0200 @@ -20,6 +20,7 @@ import tempfile import fixtures +from six.moves import mock import testtools _TRUE_VALUES = ('True', 'true', '1', 'yes') @@ -27,6 +28,56 @@ class BaseTestCase(testtools.TestCase): + """Base class for unit test classes. + + If the environment variable ``OS_TEST_TIMEOUT`` is set to an + integer value, a timer is configured to control how long + individual test cases can run. This lets tests fail for taking too + long, and prevents deadlocks from completely hanging test runs. + + If the environment variable ``OS_STDOUT_CAPTURE`` is set, a fake + stream replaces ``sys.stdout`` so the test can look at the output + it produces. + + If the environment variable ``OS_STDERR_CAPTURE`` is set, a fake + stream replaces ``sys.stderr`` so the test can look at the output + it produces. + + If the environment variable ``OS_DEBUG`` is set to a true value, + debug logging is enabled. + + If the environment variable ``OS_LOG_CAPTURE`` is set to a true + value, a logging fixture is installed to capture the log output. + + Uses the fixtures_ module to configure a :class:`NestedTempFile` + to ensure that all temporary files are created in an isolated + location. + + Uses the fixtures_ module to configure a :class:`TempHomeDir` to + change the ``HOME`` environment variable to point to a temporary + location. + + PLEASE NOTE: + Usage of this class may change the log level globally by setting the + environment variable ``OS_DEBUG``. A mock of ``time.time`` will be called + many more times than might be expected because it's called often by the + logging module. A usage of such a mock should be avoided when a test needs + to verify logging behavior or counts the number of invocations. A + workaround is to overload the ``_fake_logs`` function in a base class but + this will deactivate fake logging globally. + + .. _fixtures: https://pypi.python.org/pypi/fixtures + + """ + + def __init__(self, *args, **kwds): + super(BaseTestCase, self).__init__(*args, **kwds) + # Ensure that the mock.patch.stopall cleanup is registered + # before any setUp() methods have a chance to register other + # things to be cleaned up, so it is called last. This allows + # tests to register their own cleanups with a mock.stop method + # so those mocks are not included in the stopall set. + self.addCleanup(mock.patch.stopall) def setUp(self): super(BaseTestCase, self).setUp() @@ -55,10 +106,9 @@ self.useFixture(fixtures.MonkeyPatch('sys.stderr', stderr)) def _fake_logs(self): + level = None if os.environ.get('OS_DEBUG') in _TRUE_VALUES: level = logging.DEBUG - else: - level = logging.INFO capture_logs = os.environ.get('OS_LOG_CAPTURE') in _TRUE_VALUES if capture_logs: self.logger = self.useFixture( @@ -72,6 +122,14 @@ logging.basicConfig(format=_LOG_FORMAT, level=level) def create_tempfiles(self, files, ext='.conf'): + """Safely create temporary files. + + :param files: Sequence of tuples containing (filename, file_contents). + :type files: list of tuple + :param ext: File name extension for the temporary file. + :type ext: str + :return: A list of str with the names of the files created. + """ tempfiles = [] for (basename, contents) in files: if not os.path.isabs(basename): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslotest-1.0.0/oslotest/mockpatch.py new/oslotest-1.1.0/oslotest/mockpatch.py --- old/oslotest-1.0.0/oslotest/mockpatch.py 2014-04-01 18:50:31.000000000 +0200 +++ new/oslotest-1.1.0/oslotest/mockpatch.py 2014-09-18 14:15:05.000000000 +0200 @@ -16,7 +16,7 @@ # under the License. import fixtures -import mock +from six.moves import mock class PatchObject(fixtures.Fixture): @@ -36,7 +36,6 @@ class Patch(fixtures.Fixture): - """Deal with code around mock.patch.""" def __init__(self, obj, new=mock.DEFAULT, **kwargs): @@ -49,3 +48,33 @@ _p = mock.patch(self.obj, self.new, **self.kwargs) self.mock = _p.start() self.addCleanup(_p.stop) + + +class Multiple(fixtures.Fixture): + """Deal with code around mock.patch.multiple.""" + + # Default value to trigger a MagicMock to be created for a named + # attribute. + DEFAULT = mock.DEFAULT + + def __init__(self, obj, **kwargs): + """Initialize the mocks + + Pass name=value to replace obj.name with value. + + Pass name=Multiple.DEFAULT to replace obj.name with a + MagicMock instance. + + :param obj: Object or name containing values being mocked. + :type obj: str or object + :param kwargs: names and values of attributes of obj to be mocked. + + """ + self.obj = obj + self.kwargs = kwargs + + def setUp(self): + super(Multiple, self).setUp() + _p = mock.patch.multiple(self.obj, **self.kwargs) + self.mock = _p.start() + self.addCleanup(_p.stop) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslotest-1.0.0/oslotest/moxstubout.py new/oslotest-1.1.0/oslotest/moxstubout.py --- old/oslotest-1.0.0/oslotest/moxstubout.py 2014-04-01 18:50:31.000000000 +0200 +++ new/oslotest-1.1.0/oslotest/moxstubout.py 2014-09-18 14:15:05.000000000 +0200 @@ -16,7 +16,6 @@ # under the License. import fixtures - from six.moves import mox diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslotest-1.0.0/oslotest.egg-info/PKG-INFO new/oslotest-1.1.0/oslotest.egg-info/PKG-INFO --- old/oslotest-1.0.0/oslotest.egg-info/PKG-INFO 2014-04-01 18:50:57.000000000 +0200 +++ new/oslotest-1.1.0/oslotest.egg-info/PKG-INFO 2014-09-18 14:15:35.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: oslotest -Version: 1.0.0 +Version: 1.1.0 Summary: OpenStack test framework Home-page: http://launchpad.net/oslo Author: OpenStack @@ -10,80 +10,12 @@ oslotest ========== - OpenStack test framework and test fixtures + OpenStack test framework and test fixtures. * Free software: Apache license * Documentation: http://docs.openstack.org/developer/oslotest - - Cross-testing With Other Projects - ================================= - - The oslotest package is cross-tested against its consuming projects to - ensure that no changes to the library break the tests in those other - projects. - - In the Gate - ----------- - - To add your project to the list for cross-testing, update - ``modules/openstack_project/files/jenkins_job_builder/config/projects.yaml`` - in the openstack-infra/config git repository and add sections like: - - :: - - - '{pipeline}-oslo.test-dsvm-{name}{branch-designator}': - pipeline: check - node: 'devstack-precise || devstack-precise-check' - branch-designator: '' - branch-override: default - - '{pipeline}-oslo.test-dsvm-{name}{branch-designator}': - pipeline: gate - node: devstack-precise - branch-designator: '' - branch-override: default - - to the ``jobs`` list for your project. Refer to - https://review.openstack.org/#/c/76381 for an example. - - Then update ``modules/openstack_project/files/zuul/layout.yaml`` by - adding the new check test to the global list of jobs (to make it - non-voting to start), and then to your project and to oslo.test. - - :: - - - name: check-oslo.test-dsvm-oslo.messaging - voting: false - - :: - - - name: openstack/oslo.messaging - ... - check: - ... - - check-oslo.test-dsvm-oslo.messaging - ... - - :: - - - name: openstack/oslo.test - ... - check: - ... - - check-oslo.test-dsvm-oslo.messaging - ... - - - Locally - ------- - - To run the cross-tests locally, invoke the script directly, passing - the path to the other source repository and the tox environment name - to use: - - :: - - $ cd oslo.test - $ ./tools/run_cross_tests.sh ~/repos/openstack/oslo.config py27 + * Source: http://git.openstack.org/cgit/openstack/oslotest + * Bugs: http://bugs.launchpad.net/oslo Platform: UNKNOWN diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslotest-1.0.0/oslotest.egg-info/SOURCES.txt new/oslotest-1.1.0/oslotest.egg-info/SOURCES.txt --- old/oslotest-1.0.0/oslotest.egg-info/SOURCES.txt 2014-04-01 18:50:57.000000000 +0200 +++ new/oslotest-1.1.0/oslotest.egg-info/SOURCES.txt 2014-09-18 14:15:36.000000000 +0200 @@ -9,19 +9,18 @@ MANIFEST.in README.rst openstack-common.conf -requirements-py3.txt requirements.txt setup.cfg setup.py -test-requirements-py3.txt test-requirements.txt tox.ini +doc/source/api.rst doc/source/conf.py doc/source/contributing.rst +doc/source/features.rst doc/source/index.rst doc/source/installation.rst -doc/source/readme.rst -doc/source/usage.rst +doc/source/testing.rst oslotest/__init__.py oslotest/base.py oslotest/mockpatch.py @@ -34,6 +33,8 @@ oslotest.egg-info/top_level.txt tests/__init__.py tests/unit/__init__.py +tests/unit/test_base.py tests/unit/test_mockpatch.py tests/unit/test_moxstubout.py +tools/oslo_debug_helper.sh tools/run_cross_tests.sh \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslotest-1.0.0/oslotest.egg-info/requires.txt new/oslotest-1.1.0/oslotest.egg-info/requires.txt --- old/oslotest-1.0.0/oslotest.egg-info/requires.txt 2014-04-01 18:50:57.000000000 +0200 +++ new/oslotest-1.1.0/oslotest.egg-info/requires.txt 2014-09-18 14:15:35.000000000 +0200 @@ -1,8 +1,9 @@ discover fixtures>=0.3.14 python-subunit>=0.0.18 +six>=1.7.0 testrepository>=0.0.18 testscenarios>=0.4 testtools>=0.9.34 mock>=1.0 -mox>=0.5.3 \ No newline at end of file +mox3>=0.7.0 \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslotest-1.0.0/requirements-py3.txt new/oslotest-1.1.0/requirements-py3.txt --- old/oslotest-1.0.0/requirements-py3.txt 2014-04-01 18:50:31.000000000 +0200 +++ new/oslotest-1.1.0/requirements-py3.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1,8 +0,0 @@ -discover -fixtures>=0.3.14 -python-subunit>=0.0.18 -testscenarios>=0.4 -testrepository>=0.0.18 -testtools>=0.9.34 -mock>=1.0 -mox3>=0.7.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslotest-1.0.0/requirements.txt new/oslotest-1.1.0/requirements.txt --- old/oslotest-1.0.0/requirements.txt 2014-04-01 18:50:31.000000000 +0200 +++ new/oslotest-1.1.0/requirements.txt 2014-09-18 14:15:06.000000000 +0200 @@ -1,8 +1,9 @@ discover fixtures>=0.3.14 python-subunit>=0.0.18 +six>=1.7.0 testrepository>=0.0.18 testscenarios>=0.4 testtools>=0.9.34 mock>=1.0 -mox>=0.5.3 +mox3>=0.7.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslotest-1.0.0/setup.cfg new/oslotest-1.1.0/setup.cfg --- old/oslotest-1.0.0/setup.cfg 2014-04-01 18:50:57.000000000 +0200 +++ new/oslotest-1.1.0/setup.cfg 2014-09-18 14:15:36.000000000 +0200 @@ -22,6 +22,8 @@ [files] packages = oslotest +scripts = + tools/oslo_debug_helper.sh [global] setup-hooks = @@ -35,8 +37,14 @@ [upload_sphinx] upload-dir = doc/build/html +[pbr] +warnerrors = true + +[wheel] +universal = true + [egg_info] -tag_build = tag_date = 0 +tag_build = tag_svn_revision = 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslotest-1.0.0/setup.py new/oslotest-1.1.0/setup.py --- old/oslotest-1.0.0/setup.py 2014-04-01 18:50:31.000000000 +0200 +++ new/oslotest-1.1.0/setup.py 2014-09-18 14:15:05.000000000 +0200 @@ -17,6 +17,14 @@ # THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT import setuptools +# In python < 2.7.4, a lazy loading of package `pbr` will break +# setuptools if some other modules registered functions in `atexit`. +# solution from: http://bugs.python.org/issue15881#msg170215 +try: + import multiprocessing # noqa +except ImportError: + pass + setuptools.setup( setup_requires=['pbr'], pbr=True) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslotest-1.0.0/test-requirements-py3.txt new/oslotest-1.1.0/test-requirements-py3.txt --- old/oslotest-1.0.0/test-requirements-py3.txt 2014-04-01 18:50:31.000000000 +0200 +++ new/oslotest-1.1.0/test-requirements-py3.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1,10 +0,0 @@ -hacking>=0.8.0,<0.9 - -# when we can require tox>= 1.4, this can go into tox.ini: -# [testenv:cover] -# deps = {[testenv]deps} coverage -coverage>=3.6 - -# this is required for the docs build jobs -sphinx>=1.1.2,<1.2 -oslosphinx diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslotest-1.0.0/test-requirements.txt new/oslotest-1.1.0/test-requirements.txt --- old/oslotest-1.0.0/test-requirements.txt 2014-04-01 18:50:31.000000000 +0200 +++ new/oslotest-1.1.0/test-requirements.txt 2014-09-18 14:15:06.000000000 +0200 @@ -1,4 +1,4 @@ -hacking>=0.8.0,<0.9 +hacking>=0.9.2,<0.10 # when we can require tox>= 1.4, this can go into tox.ini: # [testenv:cover] @@ -6,5 +6,5 @@ coverage>=3.6 # this is required for the docs build jobs -sphinx>=1.1.2,<1.2 -oslosphinx +sphinx>=1.1.2,!=1.2.0,<1.3 +oslosphinx>=2.2.0.0a2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslotest-1.0.0/tests/__init__.py new/oslotest-1.1.0/tests/__init__.py --- old/oslotest-1.0.0/tests/__init__.py 2014-04-01 18:50:31.000000000 +0200 +++ new/oslotest-1.1.0/tests/__init__.py 2014-09-18 14:15:05.000000000 +0200 @@ -0,0 +1,16 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +import six + + +six.add_move(six.MovedModule('mock', 'mock', 'unittest.mock')) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslotest-1.0.0/tests/unit/test_base.py new/oslotest-1.1.0/tests/unit/test_base.py --- old/oslotest-1.0.0/tests/unit/test_base.py 1970-01-01 01:00:00.000000000 +0100 +++ new/oslotest-1.1.0/tests/unit/test_base.py 2014-09-18 14:15:05.000000000 +0200 @@ -0,0 +1,123 @@ +# Copyright 2014 Deutsche Telekom AG +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +import logging +import unittest + +from six.moves import mock +import testtools + +from oslotest import base +from oslotest import mockpatch + + +class TestBaseTestCase(testtools.TestCase): + + class FakeTestCase(base.BaseTestCase): + def test_fake_test(self): + pass + + @mock.patch('os.environ.get') + @mock.patch.object(FakeTestCase, 'useFixture') + @mock.patch('fixtures.Timeout') + def test_timeout(self, fixture_timeout_mock, fixture_mock, env_get_mock): + env_get_mock.return_value = 1 + tc = self.FakeTestCase("test_fake_test") + tc._set_timeout() + env_get_mock.assert_called_once_with('OS_TEST_TIMEOUT', 0) + fixture_timeout_mock.assert_called_once_with(1, gentle=True) + self.assertEqual(fixture_mock.call_count, 1) + + @mock.patch('os.environ.get') + @mock.patch.object(FakeTestCase, 'useFixture') + def test_fake_logs_default(self, fixture_mock, env_get_mock): + # without debug and log capture + env_get_mock.side_effect = lambda value: {'OS_DEBUG': 0, + 'OS_LOG_CAPTURE': 0}[value] + tc = self.FakeTestCase("test_fake_test") + tc._fake_logs() + env_get_mock.assert_any_call('OS_LOG_CAPTURE') + env_get_mock.assert_any_calls('OS_DEBUG') + self.assertEqual(fixture_mock.call_count, 0) + + @mock.patch('os.environ.get') + @mock.patch('logging.basicConfig') + def test_fake_logs_with_debug(self, basic_logger_mock, env_get_mock): + env_get_mock.side_effect = lambda value: {'OS_DEBUG': 'True', + 'OS_LOG_CAPTURE': 0}[value] + tc = self.FakeTestCase("test_fake_test") + tc._fake_logs() + env_get_mock.assert_any_call('OS_LOG_CAPTURE') + env_get_mock.assert_any_calls('OS_DEBUG') + basic_logger_mock.assert_called_once_with(format=base._LOG_FORMAT, + level=logging.DEBUG) + + @mock.patch('os.environ.get') + @mock.patch.object(FakeTestCase, 'useFixture') + def test_fake_logs_with_log_cap(self, fixture_mock, env_get_mock): + env_get_mock.side_effect = lambda value: {'OS_DEBUG': 0, + 'OS_LOG_CAPTURE': 'True' + }[value] + tc = self.FakeTestCase("test_fake_test") + tc._fake_logs() + env_get_mock.assert_any_call('OS_LOG_CAPTURE') + env_get_mock.assert_any_calls('OS_DEBUG') + self.assertEqual(fixture_mock.call_count, 1) + + def test_mock_patch_cleanup_on_teardown(self): + # create an object and save its reference + class Sub(object): + pass + + obj = Sub() + obj.value = obj.backup = object() + + # patch the object + mock.patch.object(obj, 'value').start() + self.assertNotEqual(obj.value, obj.backup) + + # run a test case + loader = unittest.defaultTestLoader + suite = loader.loadTestsFromTestCase(self.FakeTestCase) + suite.run(unittest.TestResult()) + + # check that mock patches are cleaned up + self.assertEqual(obj.value, obj.backup) + + +class TestManualMock(base.BaseTestCase): + + def setUp(self): + # Create a cleanup to undo a patch() call *before* calling the + # base class version of setup(). + patcher = mock.patch('os.environ.keys') + patcher.start() + self.addCleanup(patcher.stop) + super(TestManualMock, self).setUp() + self.useFixture(mockpatch.Patch('fixtures.Timeout')) + self.unstopped = mock.patch('os.environ.put') + + def tearDown(self): + super(TestManualMock, self).tearDown() + self.assertRaises( + RuntimeError, + self.unstopped.stop, + ) + + def test_mock_patch_manually(self): + # Verify that if a test instance creates its own mock and + # calls start/stop itself we don't get an error. + patcher = mock.patch('os.environ.get') + patcher.start() + self.addCleanup(patcher.stop) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslotest-1.0.0/tests/unit/test_mockpatch.py new/oslotest-1.1.0/tests/unit/test_mockpatch.py --- old/oslotest-1.0.0/tests/unit/test_mockpatch.py 2014-04-01 18:50:31.000000000 +0200 +++ new/oslotest-1.1.0/tests/unit/test_mockpatch.py 2014-09-18 14:15:05.000000000 +0200 @@ -13,7 +13,7 @@ # under the License. -import mock +from six.moves import mock from oslotest import base from oslotest import mockpatch @@ -40,6 +40,20 @@ instance = Foo() self.assertIsInstance(instance.bar(), mock.MagicMock) + +class TestMockMultiple(base.BaseTestCase): + def test_mock_multiple_with_replacement(self): + self.useFixture(mockpatch.Multiple('%s.Foo' % (__name__), + bar=mocking_bar)) + instance = Foo() + self.assertEqual(instance.bar(), 'mocked!') + + def test_mock_patch_without_replacement(self): + self.useFixture(mockpatch.Multiple('%s.Foo' % (__name__), + bar=mockpatch.Multiple.DEFAULT)) + instance = Foo() + self.assertIsInstance(instance.bar(), mock.MagicMock) + class TestMockPatchObject(base.BaseTestCase): def test_mock_patch_object_with_replacement(self): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslotest-1.0.0/tools/oslo_debug_helper.sh new/oslotest-1.1.0/tools/oslo_debug_helper.sh --- old/oslotest-1.0.0/tools/oslo_debug_helper.sh 1970-01-01 01:00:00.000000000 +0100 +++ new/oslotest-1.1.0/tools/oslo_debug_helper.sh 2014-09-18 14:15:05.000000000 +0200 @@ -0,0 +1,20 @@ +#!/bin/bash + +TMP_DIR=`mktemp -d` || exit 1 +trap "rm -rf $TMP_DIR" EXIT + +ALL_TESTS=$TMP_DIR/all_tests +TESTS_TO_RUN=$TMP_DIR/tests_to_run + +PACKAGENAME=$(python setup.py --name) + +python -m testtools.run discover -t ./ ./$PACKAGENAME/tests --list > $ALL_TESTS + +if [ "$1" ]; then + grep "$1" < $ALL_TESTS > $TESTS_TO_RUN +else + mv $ALL_TESTS $TESTS_TO_RUN +fi + +python -m testtools.run discover --load-list $TESTS_TO_RUN + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslotest-1.0.0/tox.ini new/oslotest-1.1.0/tox.ini --- old/oslotest-1.0.0/tox.ini 2014-04-01 18:50:31.000000000 +0200 +++ new/oslotest-1.1.0/tox.ini 2014-09-18 14:15:05.000000000 +0200 @@ -8,10 +8,6 @@ -r{toxinidir}/test-requirements.txt commands = python setup.py testr --slowest --testr-args='{posargs}' -[testenv:py33] -deps = -r{toxinidir}/requirements-py3.txt - -r{toxinidir}/test-requirements-py3.txt - [testenv:pep8] commands = flake8 @@ -23,10 +19,15 @@ [testenv:venv] commands = {posargs} +[testenv:docs] +commands = python setup.py build_sphinx + [flake8] show-source = True exclude = .tox,dist,doc,*.egg,build builtins = _ [hacking] -import_exceptions = six.moves.mox +import_exceptions = + six.moves.mock + six.moves.mox -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
