Commits

grahamcarlyle committed 6990d15

- rename "with" method to avoid breaking against keyword
- update setup with correct email and for easy nose testing

Comments (0)

Files changed (5)

+syntax: glob
+*~
+*.pyc
+
+syntax: regexp
+pmock.egg-info
 Programming Language :: Python
 Topic :: Software Development :: Libraries :: Python Modules
 Topic :: Software Development :: Testing
-Operating System :: OS Independent
 """
 
-from distutils.core import setup
+from setuptools import setup
 
 doclines = __doc__.split("\n")
 
 setup (
     name = "pmock",
-    version = "0.3",
+    version = "0.3.1",
     maintainer="Graham Carlyle",
-    maintainer_email="grahamcarlyle@users.sourceforge.net",
+    maintainer_email="graham@grahamcarlyle.com",
     license="Same terms as Python",
-    platforms = ["any"],
     url = "http://pmock.sf.net",
     description = doclines[0],
     classifiers = filter(None, classifiers.split("\n")),
     long_description = "\n".join(doclines[2:]),
     package_dir = {"": "src"},
-    py_modules = ["pmock"]
+    py_modules = ["pmock"],
+    tests_require=["nose"],
+    test_suite="nose.collector"
     )

src/acceptance_tests.py

 
     def setUp(self):
         self.mock = pmock.Mock()
-        self.mock.expects(pmock.once()).method("dog").with(pmock.eq("bone"))
+        self.mock.expects(pmock.once()).method("dog").with_(pmock.eq("bone"))
 
     def test_method_with_correct_arg_and_extras(self):
         try:
     def setUp(self):
         self.mock = pmock.Mock()
         self.toys = ["ball", "stick"]
-        self.mock.expects(pmock.once()).method("dog").with(
+        self.mock.expects(pmock.once()).method("dog").with_(
             pmock.eq("bone"),
             pmock.same(self.toys),
             pmock.string_contains("slipper"))
 
     def setUp(self):
         self.mock = pmock.Mock()
-        self.mock.expects(pmock.once()).method("dog").with(
+        self.mock.expects(pmock.once()).method("dog").with_(
             food=pmock.eq("bone"))
 
     def test_method_with_correct_arg_and_extra(self):
     def setUp(self):
         self.mock = pmock.Mock()
         self.mock.expects(pmock.once()).method("cat")
-        self.mock.expects(pmock.once()).method("cat").with(pmock.eq("mouse"))
+        self.mock.expects(pmock.once()).method("cat").with_(pmock.eq("mouse"))
 
     def test_method_lifo_order(self):
          self.mock.proxy().cat("mouse")
 
     def test_method_fifo_order(self):
         self.mock = pmock.Mock()
-        self.mock.expects(pmock.once()).method("cat").with(pmock.eq("mouse"))
+        self.mock.expects(pmock.once()).method("cat").with_(pmock.eq("mouse"))
         self.mock.expects(pmock.once()).method("cat")
         self.mock.proxy().cat(food="mouse")
         try:
         self.mock.verify()
 
     def test_method_name_as_id_binds_to_last_matching_expectation(self):
-        self.mock.expects(pmock.once()).method("cow").with(pmock.eq("moo"))
-        self.mock.expects(pmock.once()).method("cow").with(pmock.eq("mooo"))
+        self.mock.expects(pmock.once()).method("cow").with_(pmock.eq("moo"))
+        self.mock.expects(pmock.once()).method("cow").with_(pmock.eq("mooo"))
         self.mock.expects(pmock.once()).method("bull").after("cow")
         self.mock.proxy().cow("mooo")
         self.mock.proxy().bull()
         mock = pmock.Mock()
         mock.stubs().method("fox")
         mock.stubs().method("fox").with_at_least("sly")
-        mock.stubs().method("fox").with("sly", meal="chicken")
+        mock.stubs().method("fox").with_("sly", meal="chicken")
         mock.stubs().method("fox").will(pmock.return_value("trot"))
         self.assertEqual(mock.proxy().fox(), "trot")
         mock.fox("sly", meal="chicken")
 """
 
 __author__ = "Graham Carlyle"
-__email__ = "grahamcarlyle at users dot sourceforge dot net"
-__version__ = "0.3"
+__email__ = "graham at graham carlyle dot com"
+__version__ = "0.3.1"
 
 import unittest
 
         self._builder_namespace.register_method_name(name, self)
         return self
 
-    def with(self, *arg_constraints, **kwarg_constraints):
+    def with_(self, *arg_constraints, **kwarg_constraints):
         """Fully specify the method's arguments."""
         self._mocker.add_matcher(AllArgumentsMatcher(arg_constraints,
                                                      kwarg_constraints))

src/unit_tests.py

                          self.builder)
 
     def test_add_with_matcher(self):
-        self.assert_(self.builder.with(pmock.eq("egg")) is not None)
+        self.assert_(self.builder.with_(pmock.eq("egg")) is not None)
         self.assert_(isinstance(self.mocker.added_matcher,
                                 pmock.AllArgumentsMatcher))
         self.assert_(self.mocker.added_matcher.matches(
     def test_unicode(self):
         self.invokable.returnValue = "mock"
         unicode(self.mock)
-        self.assertInvocation("__unicode__", (), {})
+        self.assertInvocation("__str__", (), {})
 
 
 class RegisterIdTest(testsupport.ErrorMsgAssertsMixin, unittest.TestCase):