ariatosca-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From emblempar...@apache.org
Subject [1/6] incubator-ariatosca git commit: ARIA-157 Failing CLI service-templates store tests on Windows [Forced Update!]
Date Thu, 11 May 2017 17:55:48 GMT
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-148-extra-cli-commands 82193541d -> fdd57c47a (forced update)


ARIA-157 Failing CLI service-templates store tests on Windows

Three tests from `aria service-templates store` failed on Windows, but
not on Linux.

The reason for this failures was differing implementation of
os.path.dirname across the platforms.

Python implements os.path.dirname in the ntpath module. There, somewhere
down the line of calls, (a part of) the argument of dirname is tested
for membership in a string (using `in`). In these three tests, the
argument of dirname is of type MagicMock, and an error is raised since
only a string can be tested for membership in a string.

The solution was to mock the dirname calls.


Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/6864d42e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/6864d42e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/6864d42e

Branch: refs/heads/ARIA-148-extra-cli-commands
Commit: 6864d42e1748b5cd8ecc596fc1b4adc04b0cc9ba
Parents: 0af9e63
Author: Avia Efrat <avia@gigaspaces.com>
Authored: Wed May 10 17:39:49 2017 +0300
Committer: Avia Efrat <avia@gigaspaces.com>
Committed: Wed May 10 18:13:02 2017 +0300

----------------------------------------------------------------------
 tests/cli/test_service_templates.py | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/6864d42e/tests/cli/test_service_templates.py
----------------------------------------------------------------------
diff --git a/tests/cli/test_service_templates.py b/tests/cli/test_service_templates.py
index 22a8fc8..bc3c751 100644
--- a/tests/cli/test_service_templates.py
+++ b/tests/cli/test_service_templates.py
@@ -128,6 +128,7 @@ class TestServiceTemplatesStore(TestCliBase):
 
         monkeypatch.setattr(Core, 'create_service_template', mock_object)
         monkeypatch.setattr(service_template_utils, 'get', mock_object)
+        monkeypatch.setattr(os.path, 'dirname', mock_object)
         self.invoke('service_templates store stubpath {name}'.format(
             name=mock_models.SERVICE_TEMPLATE_NAME))
         assert 'Service template {name} stored'.format(
@@ -152,6 +153,7 @@ class TestServiceTemplatesStore(TestCliBase):
                             'create_service_template',
                             raise_exception(storage_exceptions.NotFoundError,
                                             msg='UNIQUE constraint failed'))
+        monkeypatch.setattr(os.path, 'dirname', mock_object)
 
         assert_exception_raised(
             self.invoke('service_templates store stubpath test_st'),
@@ -164,6 +166,7 @@ class TestServiceTemplatesStore(TestCliBase):
         monkeypatch.setattr(Core,
                             'create_service_template',
                             raise_exception(storage_exceptions.NotFoundError))
+        monkeypatch.setattr(os.path, 'dirname', mock_object)
 
         assert_exception_raised(
             self.invoke('service_templates store stubpath test_st'),


Mime
View raw message