cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edi...@apache.org
Subject git commit: updated refs/heads/pytest to 152c226
Date Thu, 18 Sep 2014 00:36:59 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/pytest c753f765f -> 152c22603


finally, xdist works as I want


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/152c2260
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/152c2260
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/152c2260

Branch: refs/heads/pytest
Commit: 152c226039a6421aa1da105870b607af27a1c2ed
Parents: c753f76
Author: Edison Su <sudison@gmail.com>
Authored: Wed Sep 17 17:36:43 2014 -0700
Committer: Edison Su <sudison@gmail.com>
Committed: Wed Sep 17 17:36:43 2014 -0700

----------------------------------------------------------------------
 test/integration/smoke/misc/test_deploy_vm.py      |  6 +++---
 test/integration/smoke/misc/test_vm_ha.py          |  4 ++--
 test/integration/smoke/misc/test_vm_sync.py        |  4 ++--
 tools/marvin/marvin/pytest/pytest_marvin_plugin.py | 15 +++++++++++++++
 tools/marvin/marvin/utils.py                       |  7 +------
 tools/pytest-xdist/xdist/dsession.py               |  5 ++---
 tools/pytest-xdist/xdist/plugin.py                 |  2 +-
 tools/pytest-xdist/xdist/remote.py                 |  8 +++++---
 8 files changed, 31 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/152c2260/test/integration/smoke/misc/test_deploy_vm.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/misc/test_deploy_vm.py b/test/integration/smoke/misc/test_deploy_vm.py
index 071d15d..20ea90e 100644
--- a/test/integration/smoke/misc/test_deploy_vm.py
+++ b/test/integration/smoke/misc/test_deploy_vm.py
@@ -32,7 +32,7 @@ from marvin.lib.utils import cleanup_resources
 #common - commonly used methods for all tests are listed here
 from marvin.lib.common import get_zone, get_domain, get_template
 
-from nose.plugins.attrib import attr
+import pytest
 
 class TestDeployVMVolumeCreationFailure(cloudstackTestCase):
     """Test VM deploy into user account with volume creation failure
@@ -81,7 +81,7 @@ class TestDeployVMVolumeCreationFailure(cloudstackTestCase):
         ]
 
 
-    @attr(tags = ['advanced'], required_hardware="simulator only")
+    @pytest.mark.tags(tags = ['advanced'], required_hardware="simulator only")
     def test_deploy_vm_volume_creation_failure(self):
         """Test Deploy Virtual Machine - volume creation failure and retry
 
@@ -192,7 +192,7 @@ class TestDeployVMStartFailure(cloudstackTestCase):
             self.mock_start_failure
         ]
 
-    @attr(tags = ['advanced'], required_hardware="simulator only")
+    @pytest.mark.tags(tags = ['advanced'], required_hardware="simulator only")
     def test_deploy_vm_start_failure(self):
         """Test Deploy Virtual Machine - start operation failure and retry
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/152c2260/test/integration/smoke/misc/test_vm_ha.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/misc/test_vm_ha.py b/test/integration/smoke/misc/test_vm_ha.py
index 601354e..0ba0da5 100644
--- a/test/integration/smoke/misc/test_vm_ha.py
+++ b/test/integration/smoke/misc/test_vm_ha.py
@@ -34,7 +34,7 @@ from marvin.lib.utils import cleanup_resources, validateList
 from marvin.lib.common import get_zone, get_domain, get_template
 from marvin.codes import PASS
 
-from nose.plugins.attrib import attr
+import pytest
 
 class TestDeployVMHA(cloudstackTestCase):
     """Test VM HA
@@ -148,7 +148,7 @@ class TestDeployVMHA(cloudstackTestCase):
         ]
         self.cleanup = self.cleanup + self.mock_checkonhost_list
 
-    @attr(tags = ['advanced'], required_hardware="simulator only")
+    @pytest.mark.tags(tags = ['advanced'], required_hardware="simulator only")
     def test_vm_ha(self):
         """Test VM HA
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/152c2260/test/integration/smoke/misc/test_vm_sync.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/misc/test_vm_sync.py b/test/integration/smoke/misc/test_vm_sync.py
index 6f2f4e9..538a1a3 100644
--- a/test/integration/smoke/misc/test_vm_sync.py
+++ b/test/integration/smoke/misc/test_vm_sync.py
@@ -33,7 +33,7 @@ from marvin.lib.utils import cleanup_resources
 #common - commonly used methods for all tests are listed here
 from marvin.lib.common import get_zone, get_domain, get_template
 
-from nose.plugins.attrib import attr
+import pytest
 
 class TestDeployVMSync(cloudstackTestCase):
     """Test VM Sync
@@ -122,7 +122,7 @@ class TestDeployVMSync(cloudstackTestCase):
             self.mock_ping
         ]
 
-    @attr(tags = ['advanced'], required_hardware="simulator only")
+    @pytest.mark.tags(tags = ['advanced'], required_hardware="simulator only")
     def test_vm_sync(self):
         """Test VM Sync
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/152c2260/tools/marvin/marvin/pytest/pytest_marvin_plugin.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/pytest/pytest_marvin_plugin.py b/tools/marvin/marvin/pytest/pytest_marvin_plugin.py
index 3ae78c8..46b91a3 100644
--- a/tools/marvin/marvin/pytest/pytest_marvin_plugin.py
+++ b/tools/marvin/marvin/pytest/pytest_marvin_plugin.py
@@ -26,6 +26,21 @@ def pytest_configure(config):
 
     marvin_init_tags()
 
+def pytest_collection_finish(session):
+    units = []
+    for item in session.items:
+        if item.instance is None and item.cls is None:
+            units.append(item.nodeid)
+        elif item.instance is not None:
+            instance = item.instance
+            name = instance.__module__ + ":" + instance.__class__.__name__
+            units.append(name)
+        else:
+            name = item.cls
+            units.append(name)
+
+    print units
+
 g_marvin_filter = {
     "tags":[],
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/152c2260/tools/marvin/marvin/utils.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/utils.py b/tools/marvin/marvin/utils.py
index e25b4c7..ef14730 100644
--- a/tools/marvin/marvin/utils.py
+++ b/tools/marvin/marvin/utils.py
@@ -43,9 +43,4 @@ def initTestClass(cls, idenifier):
     if cls.clstestclient is None:
         cls.clstestclient = marvinObj.getTestClient()
 
-    marvinObj.getTestClient().identifier = idenifier
-    if hasattr(cls, "user"):
-        # when the class-level attr applied. all test runs as 'user'
-        cls.testClient.getUserApiClient(cls.UserName,
-                                           cls.DomainName,
-                                           cls.AcctType)
\ No newline at end of file
+    marvinObj.getTestClient().identifier = idenifier
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/152c2260/tools/pytest-xdist/xdist/dsession.py
----------------------------------------------------------------------
diff --git a/tools/pytest-xdist/xdist/dsession.py b/tools/pytest-xdist/xdist/dsession.py
index 741c30b..1d6b17a 100644
--- a/tools/pytest-xdist/xdist/dsession.py
+++ b/tools/pytest-xdist/xdist/dsession.py
@@ -84,7 +84,8 @@ class LoadScheduling:
         if not self.collection_is_completed:
             return False
         for pending in self.node2pending.values():
-            self.log("pending " + str(pending))
+            for p in pending:
+                self.log("pending item: " + self.collection[p])
             if len(pending) >= 2:
                 return False
         return True
@@ -97,7 +98,6 @@ class LoadScheduling:
             self.collection_is_completed = True
 
     def remove_item(self, node, item_index, duration=0):
-        self.log("remove item" + str(item_index))
         self.node2pending[node].remove(item_index)
         self.check_schedule(node, duration=duration)
 
@@ -106,7 +106,6 @@ class LoadScheduling:
 
     def remove_node(self, node):
         self.nodes.remove(node)
-        self.log("remove node, pop up")
         pending = self.node2pending.pop(node)
         if not pending:
             return

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/152c2260/tools/pytest-xdist/xdist/plugin.py
----------------------------------------------------------------------
diff --git a/tools/pytest-xdist/xdist/plugin.py b/tools/pytest-xdist/xdist/plugin.py
index bc32104..98dfe77 100644
--- a/tools/pytest-xdist/xdist/plugin.py
+++ b/tools/pytest-xdist/xdist/plugin.py
@@ -7,7 +7,7 @@ def pytest_addoption(parser):
            action="store_true", dest="looponfail", default=False,
            help="run tests in subprocess, wait for modified files "
                 "and re-run failing test set until all pass.")
-    group._addoption('-n', dest="numprocesses", metavar="numprocesses",
+    group._addoption('-n', dest="numprocesses", metavar="numprocesses", default=2,
            action="store", type="int",
            help="shortcut for '--dist=load --tx=NUM*popen'")
     group.addoption('--boxed',

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/152c2260/tools/pytest-xdist/xdist/remote.py
----------------------------------------------------------------------
diff --git a/tools/pytest-xdist/xdist/remote.py b/tools/pytest-xdist/xdist/remote.py
index b360658..55c1610 100644
--- a/tools/pytest-xdist/xdist/remote.py
+++ b/tools/pytest-xdist/xdist/remote.py
@@ -74,13 +74,15 @@ class SlaveInteractor:
     def pytest_collection_finish(self, session):
         units = []
         for item in session.items:
-            if item.instance is None:
+            if item.instance is None and item.cls is None:
                 units.append(item.nodeid)
-            else:
+            elif item.instance is not None:
                 instance = item.instance
                 name = instance.__module__ + ":" + instance.__class__.__name__
                 units.append(name)
-
+            else:
+                name = str(item.cls)
+                units.append(name)
         self.sendevent("collectionfinish",
             topdir=str(session.fspath),
             ids=units)


Mime
View raw message