pmock.py:333: Warning: 'with' will become a reserved keyword in Python 2.6

Bug #299099 reported by Stein Magnus Jodal
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
pmock (Ubuntu)
New
Undecided
Unassigned

Bug Description

When installing python-pmock on intrepid, the following warning is printed due to a method named 'with', which will be a reserved keyword in Python 2.6:

Selecting previously deselected package python-pmock.
(Reading database ... 121144 files and directories currently installed.)
Unpacking python-pmock (from .../python-pmock_0.3-5.1_all.deb) ...
Setting up python-pmock (0.3-5.1) ...

Processing triggers for python-support ...
/var/lib/python-support/python2.5/pmock.py:313: Warning: 'with' will become a reserved keyword in Python 2.6

Revision history for this message
Kevin Thompson (kevin-thompson) wrote :

I'm not sure how to handle this. I went to the project sourceforge page and checked it out and it seems that the main project has this problem too. It would be pretty easy to just change the name of the function on line 313, but then it might break something else. What's the best way to handle this? Place a bug report with the project? Submit a patch to him?

Revision history for this message
Stein Magnus Jodal (jodal) wrote :

As this was not fixed before the release of Jaunty where the default Python is 2.6.2, pmock is now not working at all.

    $ python
    >>> import pmock
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/var/lib/python-support/python2.6/pmock.py", line 313
        def with(self, *arg_constraints, **kwarg_constraints):
               ^
    SyntaxError: invalid syntax
    >>>

Revision history for this message
Dariusz Suchojad (dsuch) wrote :

Hello,

I wanted a version of pmock compatible with Python 2.5+ and that's why I created pmocky, a fork of pmock. I had first contacted the original author and he'd okayed to the idea. The source code is here https://launchpad.net/pmocky, and packages for Intrepid can be found in my PPA https://launchpad.net/~dsuch/+archive/ppa, it's pmocky - 1.0-1~ppa3. I plan to do some minimal development however the main reason for forking it was to have it available in Python 2.5+, that's why the only change so far was renaming the "with" method to "with_". If you are still interested in using it then I would appreciate if you could take a look at it. Thanks.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.