You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ed...@apache.org on 2014/09/10 01:42:13 UTC
git commit: updated refs/heads/pytest to 2b45f67
Repository: cloudstack
Updated Branches:
refs/heads/pytest [created] 2b45f67bc
switch nose to py.test
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/2b45f67b
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/2b45f67b
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/2b45f67b
Branch: refs/heads/pytest
Commit: 2b45f67bc92be9bdc6784da22255b2f843e6fa95
Parents: 07c9c02
Author: edison <su...@gmail.com>
Authored: Tue Sep 9 16:39:08 2014 -0700
Committer: edison <su...@gmail.com>
Committed: Tue Sep 9 16:41:12 2014 -0700
----------------------------------------------------------------------
test/integration/smoke/conftest.py | 17 +++++++
tools/apidoc/build-apidoc.sh | 2 +-
tools/marvin/marvin/pytest_marvin_plugin.py | 60 ++++++++++++++++++++++++
3 files changed, 78 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2b45f67b/test/integration/smoke/conftest.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/conftest.py b/test/integration/smoke/conftest.py
new file mode 100644
index 0000000..5d359f5
--- /dev/null
+++ b/test/integration/smoke/conftest.py
@@ -0,0 +1,17 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+pytest_plugins = "marvin.pytest_marvin_plugin"
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2b45f67b/tools/apidoc/build-apidoc.sh
----------------------------------------------------------------------
diff --git a/tools/apidoc/build-apidoc.sh b/tools/apidoc/build-apidoc.sh
index 03eb687..3772e56 100755
--- a/tools/apidoc/build-apidoc.sh
+++ b/tools/apidoc/build-apidoc.sh
@@ -41,7 +41,7 @@ canonical_readlink ()
thisdir=$(canonical_readlink $0)
PATHSEP=':'
-if [[ $OSTYPE == "cygwin" ]] ; then
+if [[ ($OSTYPE == "cygwin") || ($OSTYPE == "msys") ]] ; then
PATHSEP=';'
fi
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2b45f67b/tools/marvin/marvin/pytest_marvin_plugin.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/pytest_marvin_plugin.py b/tools/marvin/marvin/pytest_marvin_plugin.py
new file mode 100644
index 0000000..5b66cc2
--- /dev/null
+++ b/tools/marvin/marvin/pytest_marvin_plugin.py
@@ -0,0 +1,60 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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 pytest
+import os
+from marvin.marvinPlugin import MarvinInit
+from marvin.codes import FAILED
+
+global_marvin_obj = None
+def pytest_configure():
+ configFile = os.environ.get("MARVIN_CONFIG", os.path.join(os.path.dirname(os.path.realpath(__file__)),"..", "..", "..", "setup", "dev", "advanced.cfg"))
+ deployDcb = False
+ deployDc = os.environ.get("MARVIN_DEPLOY_DC", "false")
+ if deployDc in ["True", "true"]:
+ deployDcb = True
+ zoneName = os.environ.get("MARVIN_ZONE_NAME", "Sandbox-simulator")
+ hypervisor_type = os.environ.get("MARVIN_HYPERVISOR_TYPE", "simulator")
+ logFolder = os.environ.get("MARVIN_LOG_FOLDER", os.path.expanduser(os.path.join("~","marvin")))
+
+ global global_marvin_obj
+ global_marvin_obj = MarvinInit(configFile,
+ deployDcb,
+ None,
+ zoneName,
+ hypervisor_type,
+ logFolder)
+
+ result = global_marvin_obj.init()
+ if result == FAILED:
+ pytest.fail("failed to init marvin plugin")
+
+@pytest.fixture(scope="class", autouse=True)
+def marvin_inject_testclass(request):
+ global global_marvin_obj
+ test = request.cls
+ setattr(test, "debug", global_marvin_obj.getLogger().debug)
+ setattr(test, "info", global_marvin_obj.getLogger().info)
+ setattr(test, "warn", global_marvin_obj.getLogger().warning)
+ setattr(test, "error",global_marvin_obj.getLogger().error)
+ setattr(test, "testClient", global_marvin_obj.getTestClient())
+ setattr(test, "config", global_marvin_obj.getParsedConfig())
+ setattr(test, "clstestclient", global_marvin_obj.getTestClient())
+ if hasattr(test, "user"):
+ # when the class-level attr applied. all test runs as 'user'
+ request.testClient.getUserApiClient(test.UserName,
+ test.DomainName,
+ test.AcctType)