summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMonty Taylor <mordred@inaugust.com>2013-05-21 16:54:51 -0400
committerMonty Taylor <mordred@inaugust.com>2013-05-21 16:59:38 -0400
commit24bd40737ac97ad32226fbd29b50fda05de00364 (patch)
tree9e5f508133be95fe69ff39a5a5b723021139e5a8
parentde1221109c28331684ed4d56913ee6d7541b0cc1 (diff)
downloadpymox-24bd40737ac97ad32226fbd29b50fda05de00364.tar.gz
Updated to use OpenStack standards.
-rw-r--r--.gitignore1
-rw-r--r--.testr.conf4
-rw-r--r--.travis.yml9
-rw-r--r--MANIFEST.in8
-rw-r--r--README.rst52
-rw-r--r--README.txt33
-rw-r--r--mox3/tests/mox_helper.py6
-rw-r--r--mox3/tests/test_mox.py (renamed from mox3/tests/mox_test.py)9
-rw-r--r--mox3/tests/test_stubout.py (renamed from mox3/tests/stubout_test.py)1
-rw-r--r--requirements.txt2
-rw-r--r--setup.cfg27
-rw-r--r--setup.py38
-rw-r--r--test-requirements.txt12
-rw-r--r--tox.ini27
14 files changed, 147 insertions, 82 deletions
diff --git a/.gitignore b/.gitignore
index ddbe7a3..4d66c82 100644
--- a/.gitignore
+++ b/.gitignore
@@ -19,6 +19,7 @@ pip-log.txt
# Unit test / coverage reports
.coverage
.tox
+.testrepository
#Translations
*.mo
diff --git a/.testr.conf b/.testr.conf
new file mode 100644
index 0000000..6c1541e
--- /dev/null
+++ b/.testr.conf
@@ -0,0 +1,4 @@
+[DEFAULT]
+test_command=OS_STDOUT_CAPTURE=1 OS_STDERR_CAPTURE=1 OS_TEST_TIMEOUT=60 ${PYTHON:-python} -m subunit.run discover -t ./ ./ $LISTOPT $IDOPTION
+test_id_option=--load-list $IDFILE
+test_list_option=--list
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 7a9fe91..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,9 +0,0 @@
-language: python
-python:
- - "2.6"
- - "2.7"
- - "3.2"
-install: pip install pep8
-script:
- - pep8 --ignore E111 *.py || echo "Done"
- - nosetests
diff --git a/MANIFEST.in b/MANIFEST.in
index b5ad0c1..c978a52 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,2 +1,6 @@
-include COPYING.txt
-include README.txt
+include AUTHORS
+include ChangeLog
+exclude .gitignore
+exclude .gitreview
+
+global-exclude *.pyc
diff --git a/README.rst b/README.rst
new file mode 100644
index 0000000..01ca1b8
--- /dev/null
+++ b/README.rst
@@ -0,0 +1,52 @@
+Mox3 - Mock object framework for Python 3
+=========================================
+
+Mox3 is an unofficial port of the Google mox framework
+(http://code.google.com/p/pymox/) to Python 3. It was meant to be as compatible
+with mox as possible, but small enhancements have been made. The library was
+tested on Python version 3.2, 2.7 and 2.6.
+
+Use at your own risk ;)
+
+To install:
+
+ $ python setup.py install
+
+Running Tests
+-------------
+The testing system is based on a combination of tox and testr. The canonical
+approach to running tests is to simply run the command `tox`. This will
+create virtual environments, populate them with depenedencies and run all of
+the tests that OpenStack CI systems run. Behind the scenes, tox is running
+`testr run --parallel`, but is set up such that you can supply any additional
+testr arguments that are needed to tox. For example, you can run:
+`tox -- --analyze-isolation` to cause tox to tell testr to add
+--analyze-isolation to its argument list.
+
+It is also possible to run the tests inside of a virtual environment
+you have created, or it is possible that you have all of the dependencies
+installed locally already. In this case, you can interact with the testr
+command directly. Running `testr run` will run the entire test suite. `testr
+run --parallel` will run it in parallel (this is the default incantation tox
+uses.) More information about testr can be found at:
+http://wiki.openstack.org/testr
+
+Basic Usage
+-----------
+
+The basic usage of mox3 is the same as with mox, but the initial import should
+be made from the mox3 module:
+
+ from mox3 import mox
+
+To learn how to use mox3 you may check the documentation of the original mox
+framework:
+
+ http://code.google.com/p/pymox/wiki/MoxDocumentation
+
+Original Copyright
+------------------
+
+Mox is Copyright 2008 Google Inc, and licensed under the Apache
+License, Version 2.0; see the file COPYING.txt for details. If you would
+like to help us improve Mox, join the group.
diff --git a/README.txt b/README.txt
deleted file mode 100644
index 0c7badc..0000000
--- a/README.txt
+++ /dev/null
@@ -1,33 +0,0 @@
-Mox3 - Mock object framework for Python 3.
-
-Mox3 is an unofficial port of the Google mox framework
-(http://code.google.com/p/pymox/) to Python 3. It was meant to be as compatible
-with mox as possible, but small enhancements have been made. The library was
-tested on Python version 3.2, 2.7 and 2.6.
-
-Use at your own risk ;)
-
-To install:
-
- $ python setup.py install
-
-To run Mox3 internal tests you should download python-nose package and execute
-(in mox3 directory):
-
- $ nosetests
-
-The basic usage of mox3 is the same as with mox, but the initial import should
-be made from the mox3 module:
-
- from mox3 import mox
-
-To learn how to use mox3 you may check the documentation of the original mox
-framework:
-
- http://code.google.com/p/pymox/wiki/MoxDocumentation
-
---
-
-Mox is Copyright 2008 Google Inc, and licensed under the Apache
-License, Version 2.0; see the file COPYING for details. If you would
-like to help us improve Mox, join the group.
diff --git a/mox3/tests/mox_helper.py b/mox3/tests/mox_helper.py
index ca990c1..4191ba6 100644
--- a/mox3/tests/mox_helper.py
+++ b/mox3/tests/mox_helper.py
@@ -16,15 +16,15 @@
# This is a fork of the pymox library intended to work with Python 3.
# The file was modified by quermit@gmail.com and dawid.fatyga@gmail.com
-"""A very basic test class derived from mox.MoxTestBase, used by mox_test.py.
+"""A very basic test class derived from mox.MoxTestBase, used by test_mox.py.
The class defined in this module is used to test the features of
MoxTestBase and is not intended to be a standalone test. It needs to
be in a separate module, because otherwise the tests in this class
(which should not all pass) would be executed as part of the
-mox_test.py test suite.
+test_mox.py test suite.
-See mox_test.MoxTestBaseTest for how this class is actually used.
+See test_mox.MoxTestBaseTest for how this class is actually used.
"""
import os
diff --git a/mox3/tests/mox_test.py b/mox3/tests/test_mox.py
index 990d9a3..a331f3d 100644
--- a/mox3/tests/mox_test.py
+++ b/mox3/tests/test_mox.py
@@ -14,7 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-#
# This is a fork of the pymox library intended to work with Python 3.
# The file was modified by quermit@gmail.com and dawid.fatyga@gmail.com
@@ -97,13 +96,13 @@ class AndTest(unittest.TestCase):
"""
test_dict = {"mock": "obj", "testing": "isCOOL"}
self.assertTrue(mox.And(mox.In("testing"),
- mox.ContainsKeyValue("mock", "obj")) == test_dict)
+ mox.ContainsKeyValue("mock", "obj")) == test_dict)
def testAdvancedUsageFails(self):
"""Note: this test is reliant on In and ContainsKeyValue."""
test_dict = {"mock": "obj", "testing": "isCOOL"}
self.assertFalse(mox.And(mox.In("NOTFOUND"),
- mox.ContainsKeyValue("mock", "obj")) == test_dict)
+ mox.ContainsKeyValue("mock", "obj")) == test_dict)
class FuncTest(unittest.TestCase):
@@ -2275,8 +2274,8 @@ class MoxTestBaseMultipleInheritanceTest(mox.MoxTestBase, MyTestCase):
class MoxTestDontMockProperties(MoxTestBaseTest):
def testPropertiesArentMocked(self):
mock_class = self.mox.CreateMock(ClassWithProperties)
- self.assertRaises(mox.UnknownMethodCallError, lambda:
- mock_class.prop_attr)
+ self.assertRaises(mox.UnknownMethodCallError,
+ lambda: mock_class.prop_attr)
class TestClass(object):
diff --git a/mox3/tests/stubout_test.py b/mox3/tests/test_stubout.py
index 3426537..be9a94c 100644
--- a/mox3/tests/stubout_test.py
+++ b/mox3/tests/test_stubout.py
@@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-#
# This is a fork of the pymox library intended to work with Python 3.
# The file was modified by quermit@gmail.com and dawid.fatyga@gmail.com
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 0000000..116b699
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1,2 @@
+d2to1>=0.2.10,<0.3
+pbr>=0.5.10,<0.6
diff --git a/setup.cfg b/setup.cfg
new file mode 100644
index 0000000..4a3de06
--- /dev/null
+++ b/setup.cfg
@@ -0,0 +1,27 @@
+[metadata]
+name = mox3
+summary = Mock object framework for Python
+description-file =
+ README.rst
+author = OpenStack
+author-email = openstack-dev@lists.openstack.org
+home-page = http://www.openstack.org/
+classifiers =
+ Environment :: OpenStack
+ Programming Language :: Python
+ License :: OSI Approved :: Apache Software License
+ Programming Language :: Python :: 2.6
+ Programming Language :: Python :: 2.7
+ Programming Language :: Python :: 3
+ Operating System :: OS Independent
+ Development Status :: 4 - Beta
+ Intended Audience :: Developers
+ Topic :: Software Development :: Testing
+
+[files]
+packages =
+ mox3
+
+[global]
+setup-hooks =
+ pbr.hooks.setup_hook
diff --git a/setup.py b/setup.py
index 751f082..b3e85a7 100644
--- a/setup.py
+++ b/setup.py
@@ -1,41 +1,21 @@
-# Copyright 2008 Google Inc.
+#!/usr/bin/env python
+# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
#
# 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
+# 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.
+# 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.
-#
-#
-# This is a fork of the pymox library intended to work with Python 3.
-# The file was modified by quermit@gmail.com and dawid.fatyga@gmail.com
-from distutils.core import setup
+import setuptools
-setup(name='mox3',
- version='0.6.0',
- packages=['mox3', 'mox3.tests'],
- url='https://github.com/openstack-dev/mox3',
- maintainer='OpenStack Developers',
- maintainer_email='openstack-dev@lists.openstack.org',
- license='Apache License, Version 2.0',
- description='Mock object framework for Python 3',
- long_description=('Mox3 is an unofficial port of the of the mox '
- 'framework to Python 3. The library was tested on '
- 'Python version 3.2, 2.7 and 2.6.'),
- classifiers=['Programming Language :: Python',
- 'License :: OSI Approved :: Apache Software License',
- 'Programming Language :: Python :: 2.6',
- 'Programming Language :: Python :: 2.7',
- 'Programming Language :: Python :: 3',
- 'Operating System :: OS Independent',
- 'Development Status :: 4 - Beta',
- 'Intended Audience :: Developers',
- 'Topic :: Software Development :: Testing'],
- )
+setuptools.setup(
+ setup_requires=['d2to1>=0.2.10,<0.3', 'pbr>=0.5.10,<0.6'],
+ d2to1=True)
diff --git a/test-requirements.txt b/test-requirements.txt
new file mode 100644
index 0000000..d682806
--- /dev/null
+++ b/test-requirements.txt
@@ -0,0 +1,12 @@
+# this file lists dependencies required for the testing of heat
+distribute>=0.6.28
+
+# Install bounded pep8/pyflakes first, then let flake8 install
+pep8==1.4.5
+pyflakes==0.7.2
+flake8==2.0
+hacking>=0.5.3,<0.6
+
+coverage
+discover
+testrepository>=0.0.13
diff --git a/tox.ini b/tox.ini
new file mode 100644
index 0000000..2b30581
--- /dev/null
+++ b/tox.ini
@@ -0,0 +1,27 @@
+[tox]
+envlist = py26,py27,pep8
+
+[testenv]
+setenv = VIRTUAL_ENV={envdir}
+deps = -r{toxinidir}/requirements.txt
+ -r{toxinidir}/test-requirements.txt
+commands =
+ python tools/patch_tox_venv.py
+ python setup.py testr --slowest --testr-args='{posargs}'
+
+[testenv:pep8]
+commands = flake8
+
+[testenv:venv]
+commands = {posargs}
+
+[testenv:cover]
+setenv = VIRTUAL_ENV={envdir}
+commands =
+ python setup.py testr --coverage
+
+[flake8]
+show-source = true
+ignore = H,E11
+builtins = _
+exclude=.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg