From patchwork Mon Dec 21 20:47:01 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Russell Bryant X-Patchwork-Id: 559697 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (unknown [IPv6:2600:3c00::f03c:91ff:fe6e:bdf7]) by ozlabs.org (Postfix) with ESMTP id 77C82140323 for ; Tue, 22 Dec 2015 07:48:07 +1100 (AEDT) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id 3D29A10598; Mon, 21 Dec 2015 12:48:06 -0800 (PST) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx3v3.cudamail.com (mx3.cudamail.com [64.34.241.5]) by archives.nicira.com (Postfix) with ESMTPS id BB53610598 for ; Mon, 21 Dec 2015 12:48:05 -0800 (PST) Received: from bar3.cudamail.com (localhost [127.0.0.1]) by mx3v3.cudamail.com (Postfix) with ESMTPS id EE9D2161B68 for ; Mon, 21 Dec 2015 13:48:04 -0700 (MST) X-ASG-Debug-ID: 1450730884-03dd7b579c420450001-byXFYA Received: from mx3-pf1.cudamail.com ([192.168.14.2]) by bar3.cudamail.com with ESMTP id GmFqdjVGO2BeNYvL (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 21 Dec 2015 13:48:04 -0700 (MST) X-Barracuda-Envelope-From: russell@ovn.org X-Barracuda-RBL-Trusted-Forwarder: 192.168.14.2 Received: from unknown (HELO mx1.redhat.com) (209.132.183.28) by mx3-pf1.cudamail.com with ESMTPS (DHE-RSA-AES256-SHA encrypted); 21 Dec 2015 20:48:04 -0000 Received-SPF: neutral (mx3-pf1.cudamail.com: 209.132.183.28 is neither permitted nor denied by SPF record at ovn.org) X-Barracuda-Apparent-Source-IP: 209.132.183.28 X-Barracuda-RBL-IP: 209.132.183.28 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id 67DAC3B712; Mon, 21 Dec 2015 20:48:03 +0000 (UTC) Received: from x1c.redhat.com ([10.3.112.11]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id tBLKm0dO002018; Mon, 21 Dec 2015 15:48:02 -0500 X-CudaMail-Envelope-Sender: russell@ovn.org From: Russell Bryant To: dev@openvswitch.org X-CudaMail-Whitelist-To: dev@openvswitch.org X-CudaMail-MID: CM-V1-1220054094 X-CudaMail-DTE: 122115 X-CudaMail-Originating-IP: 209.132.183.28 Date: Mon, 21 Dec 2015 15:47:01 -0500 X-ASG-Orig-Subj: [##CM-V1-1220054094##][PATCH 01/55] python: Set up initial tox test environment. Message-Id: <1450730875-18083-2-git-send-email-russell@ovn.org> In-Reply-To: <1450730875-18083-1-git-send-email-russell@ovn.org> References: <1450730875-18083-1-git-send-email-russell@ovn.org> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Barracuda-Connect: UNKNOWN[192.168.14.2] X-Barracuda-Start-Time: 1450730884 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-ASG-Whitelist: Header =?UTF-8?B?eFwtY3VkYW1haWxcLXdoaXRlbGlzdFwtdG8=?= X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 Subject: [ovs-dev] [PATCH 01/55] python: Set up initial tox test environment. X-BeenThere: dev@openvswitch.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dev-bounces@openvswitch.org Sender: "dev" tox is a tool for running Python tests in virtual Python environments. This initial setup only attempts to install the ovs Python library in both a virtual Python 2.7 environment and a virtual Python 3.4 environment. We also run the beginning of a test suite, which only imports the code. This quickly reproduces the problem that the library fails to install for Python 3. Future patches will start addressing Python 3 compatibility. Signed-off-by: Russell Bryant --- python/.gitignore | 3 +++ python/automake.mk | 10 +++++++++- python/ovs/tests/__init__.py | 1 + python/ovs/tests/test_ovs.py | 46 ++++++++++++++++++++++++++++++++++++++++++++ python/requirements.txt | 1 + python/test-requirements.txt | 2 ++ python/tox.ini | 13 +++++++++++++ 7 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 python/ovs/tests/__init__.py create mode 100644 python/ovs/tests/test_ovs.py create mode 100644 python/requirements.txt create mode 100644 python/test-requirements.txt create mode 100644 python/tox.ini diff --git a/python/.gitignore b/python/.gitignore index 60ace6f..ddf3457 100644 --- a/python/.gitignore +++ b/python/.gitignore @@ -1,2 +1,5 @@ dist/ *.egg-info +.tox/ +.cache/ +htmlcov diff --git a/python/automake.mk b/python/automake.mk index 42b428a..a86bcaa 100644 --- a/python/automake.mk +++ b/python/automake.mk @@ -33,7 +33,9 @@ ovs_pyfiles = \ python/ovs/unixctl/server.py \ python/ovs/util.py \ python/ovs/version.py \ - python/ovs/vlog.py + python/ovs/vlog.py \ + python/ovs/tests/__init__.py \ + python/ovs/tests/test_ovs.py # These python files are used at build time but not runtime, # so they are not installed. @@ -46,6 +48,12 @@ EXTRA_DIST += \ python/README.rst \ python/setup.py +# Test suite related files +EXTRA_DIST += \ + python/tox.ini \ + python/requirements.txt \ + python/test-requirements.txt + PYFILES = $(ovs_pyfiles) python/ovs/dirs.py $(ovstest_pyfiles) EXTRA_DIST += $(PYFILES) PYCOV_CLEAN_FILES += $(PYFILES:.py=.py,cover) diff --git a/python/ovs/tests/__init__.py b/python/ovs/tests/__init__.py new file mode 100644 index 0000000..218d892 --- /dev/null +++ b/python/ovs/tests/__init__.py @@ -0,0 +1 @@ +# This file intentionally left blank. diff --git a/python/ovs/tests/test_ovs.py b/python/ovs/tests/test_ovs.py new file mode 100644 index 0000000..2525259 --- /dev/null +++ b/python/ovs/tests/test_ovs.py @@ -0,0 +1,46 @@ +# 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 unittest + +# Import everything from the ovs lib to ensure all modules show up in the +# coverage report. It also ensures that if we don't have test coverage yet, +# they can at least be successfully imported. +import ovs.jsonrpc # noqa +import ovs.tests.test_ovs # noqa +import ovs.version # noqa +import ovs.timeval # noqa +import ovs.daemon # noqa +import ovs.reconnect # noqa +import ovs.vlog # noqa +import ovs.json # noqa +import ovs.stream # noqa +import ovs.fatal_signal # noqa +import ovs.ovsuuid # noqa +import ovs.dirs # noqa +import ovs.util # noqa +import ovs.socket_util # noqa +import ovs.process # noqa +import ovs.poller # noqa +import ovs.unixctl.client # noqa +import ovs.unixctl.server # noqa +import ovs.db.data # noqa +import ovs.db.idl # noqa +import ovs.db.parser # noqa +import ovs.db.types # noqa +import ovs.db.schema # noqa +import ovs.db.error # noqa + + +class TestOVS(unittest.TestCase): + def test_pass(self): + pass diff --git a/python/requirements.txt b/python/requirements.txt new file mode 100644 index 0000000..e7c0136 --- /dev/null +++ b/python/requirements.txt @@ -0,0 +1 @@ +# runtime dependencies diff --git a/python/test-requirements.txt b/python/test-requirements.txt new file mode 100644 index 0000000..eae9d4f --- /dev/null +++ b/python/test-requirements.txt @@ -0,0 +1,2 @@ +# test dependencies +nose diff --git a/python/tox.ini b/python/tox.ini new file mode 100644 index 0000000..06b2e2a --- /dev/null +++ b/python/tox.ini @@ -0,0 +1,13 @@ +# Tox (http://tox.testrun.org/) is a tool for running tests +# in multiple virtualenvs. This configuration file will run the +# test suite on all supported python versions. To use it, "pip install tox" +# and then run "tox" from this directory. + +[tox] +envlist = py27,py34 + +[testenv] +usedevelop = True +commands = {envbindir}/nosetests ovs/tests +deps = -r{toxinidir}/requirements.txt + -r{toxinidir}/test-requirements.txt