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 c753f76
Date Wed, 17 Sep 2014 22:05:42 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/pytest 797fff165 -> c753f765f


fix xdist


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

Branch: refs/heads/pytest
Commit: c753f765ff990343b429f77e0c21ab08eb542cc5
Parents: 797fff1
Author: edison <sudison@gmail.com>
Authored: Wed Sep 17 15:05:05 2014 -0700
Committer: edison <sudison@gmail.com>
Committed: Wed Sep 17 15:05:05 2014 -0700

----------------------------------------------------------------------
 test/integration/smoke/test_CS-18306.py         | 22 +++++++--
 .../marvin/pytest/pytest_marvin_plugin.py       |  5 ++
 tools/pytest-xdist/xdist/dsession.py            | 48 ++++++++++----------
 tools/pytest-xdist/xdist/remote.py              |  4 +-
 4 files changed, 49 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c753f765/test/integration/smoke/test_CS-18306.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_CS-18306.py b/test/integration/smoke/test_CS-18306.py
index 072da93..93d2d39 100644
--- a/test/integration/smoke/test_CS-18306.py
+++ b/test/integration/smoke/test_CS-18306.py
@@ -23,16 +23,30 @@ def test_01_create_disk_offering(vm):
     assert vm is not None
 '''
 
-class TestA:
+import time
+
+class TestP:
     def test_a(self):
         assert True == True
-
     def test_b(self):
         assert True == True
-
+    def test_aaa(self):
+        assert True == True
 
 def test_aa():
     assert True == True
 
 def test_bb():
-    assert True == True
\ No newline at end of file
+    assert True == True
+
+class TestA:
+    def test_aaa(self):
+        assert True == True
+    def test_bbb(self):
+        assert True == True
+    def test_ccc(self):
+        assert True == True
+
+
+def test_cc():
+    assert True == True

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c753f765/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 abe844b..3ae78c8 100644
--- a/tools/marvin/marvin/pytest/pytest_marvin_plugin.py
+++ b/tools/marvin/marvin/pytest/pytest_marvin_plugin.py
@@ -65,6 +65,8 @@ def pytest_runtest_setup(item):
 @pytest.fixture(scope="session", autouse=True)
 def marvin_init_session():
     result = getMarvin()
+    logger = result.getLogger()
+    logger.debug("in session")
     if result is None:
         pytest.fail("failed to init marvin plugin")
 
@@ -82,6 +84,9 @@ def marvin_init_function(request):
     if request.cls is not None:
         return
     marvinObj = getMarvin()
+    logger = marvinObj.getLogger()
+    #logger.debug("in function")
+
     setattr(request.node, "testClient", marvinObj.getTestClient())
 
     marvinObj.getTestClient().identifier = request.node.name

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c753f765/tools/pytest-xdist/xdist/dsession.py
----------------------------------------------------------------------
diff --git a/tools/pytest-xdist/xdist/dsession.py b/tools/pytest-xdist/xdist/dsession.py
index e5c6609..741c30b 100644
--- a/tools/pytest-xdist/xdist/dsession.py
+++ b/tools/pytest-xdist/xdist/dsession.py
@@ -66,6 +66,7 @@ class LoadScheduling:
         self.node2collection = {}
         self.nodes = []
         self.pending = []
+        self.cnt = 1
         if log is None:
             self.log = py.log.Producer("loadsched")
         else:
@@ -83,6 +84,7 @@ class LoadScheduling:
         if not self.collection_is_completed:
             return False
         for pending in self.node2pending.values():
+            self.log("pending " + str(pending))
             if len(pending) >= 2:
                 return False
         return True
@@ -95,18 +97,16 @@ 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)
 
     def check_schedule(self, node, duration=0):
-        if self.pending or len(self.node2collection[node] > 0):
-            self._send_tests(node)
-
-        self.log("num items waiting for node:", len(self.pending))
-        #self.log("node2pending:", self.node2pending)
+        self._send_tests(node)
 
     def remove_node(self, node):
         self.nodes.remove(node)
+        self.log("remove node, pop up")
         pending = self.node2pending.pop(node)
         if not pending:
             return
@@ -140,23 +140,22 @@ class LoadScheduling:
 
     #f = open("/tmp/sent", "w")
     def _send_tests(self, node):
-        if len(self.node2collection[node]) > 0:
-            index = self.node2collection[node].pop(0)
-            print index
-            node.send_runtest_some([index])
-        #print >>self.f, "sent", node, tests_per_node
-        else:
-            index = self.pending.pop(0)
-            item = self.collection[index]
-            #how many items
-            indexs = [index]
-            for pos,name in enumerate(self.collection):
-                if name == item and pos != index:
-                    idx = self.pending.pop(0)
-                    indexs.append(idx)
-            self.node2collection[node] = indexs
-            print index
-            node.send_runtest_some([index])
+        if self.pending:
+            indexs = []
+            while (len(indexs) + len(self.node2pending[node])) < 2 and len(self.pending)
> 0:
+                index = self.pending.pop(0)
+                indexs.append(index)
+                item = self.collection[index]
+                for pos,i in enumerate(self.collection):
+                    if len(self.pending) == 0:
+                        break
+                    elif pos != index and item == i:
+                        pos = self.pending.pop(0)
+                        indexs.append(pos)
+
+            if indexs:
+                self.node2pending[node].extend(indexs)
+                node.send_runtest_some(indexs)
 
     def _check_nodes_have_same_collection(self):
         """
@@ -211,8 +210,8 @@ class DSession:
     def __init__(self, config):
         self.config = config
         self.log = py.log.Producer("dsession")
-        if not config.option.debug:
-            py.log.setconsumer(self.log._keywords, None)
+        #if not config.option.debug:
+        #    py.log.setconsumer(self.log._keywords, None)
         self.shuttingdown = False
         self.countfailures = 0
         self.maxfail = config.getvalue("maxfail")
@@ -293,6 +292,7 @@ class DSession:
             node.shutdown()
 
     def slave_slavefinished(self, node):
+        self.log("slave finished")
         self.config.hook.pytest_testnodedown(node=node, error=None)
         if node.slaveoutput['exitstatus'] == 2: # keyboard-interrupt
             self.shouldstop = "%s received keyboard-interrupt" % (node,)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c753f765/tools/pytest-xdist/xdist/remote.py
----------------------------------------------------------------------
diff --git a/tools/pytest-xdist/xdist/remote.py b/tools/pytest-xdist/xdist/remote.py
index dbe233f..b360658 100644
--- a/tools/pytest-xdist/xdist/remote.py
+++ b/tools/pytest-xdist/xdist/remote.py
@@ -13,8 +13,8 @@ class SlaveInteractor:
         self.config = config
         self.slaveid = config.slaveinput.get('slaveid', "?")
         self.log = py.log.Producer("slave-%s" % self.slaveid)
-        if not config.option.debug:
-            py.log.setconsumer(self.log._keywords, None)
+        #if not config.option.debug:
+        #    py.log.setconsumer(self.log._keywords, None)
         self.channel = channel
         config.pluginmanager.register(self)
 


Mime
View raw message