Roundup Tracker - Issues

Message7668

Author rouilj
Recipients rouilj, schlatterbeck
Date 2022-11-23.20:33:03
Message-id <20221123203258.B4CB46A0014@pe15.cs.umb.edu>
In-reply-to <20221123172044.gxvyr74nuw5klbfy@runtux.com>
Hi Ralf:

In message <20221123172044.gxvyr74nuw5klbfy@runtux.com>,
Ralf Schlatterbeck writes:
>On Wed, Nov 23, 2022 at 03:25:05PM +0000, John Rouillard wrote:
>> 
>> try:
>>   import mock
>> except ImportError:
>>   import unittest.mock as mock
>
>OK, you know that roundup has its own mock module in
>roundup/test/mocknull.py? Does this do the same thing?

It has no patch method so I claim it does not do the same thing.

>> I have no error of that type in CI (ubuntu 3.11 and lower). What is your
>> OS?
>
>Debian, both oldstable and stable do not have a mock.
>I do have unittest installed on both systems.
>
>    from unittest import mock
>
>work on both of them.

Ok.

>> My guess is mock/mock.py was installed as a (default) package in some python
>> distributions:
>> 
>>   % dpkg -S /usr/lib/python3/dist-packages/mock/mock.py
>>   python3-mock: /usr/lib/python3/dist-packages/mock/mock.py
>
>Yes, seems not very portable, lets use either unittest.mock or the one
>that comes with roundup.

unittest.mock isn't in 2.7. So I maybe:

  try:
    import unittest.mock as mock
  except ImportError:
    import mock

Make the 3.x the default path and 2.x the compatibility exception.
History
Date User Action Args
2022-11-23 20:33:03rouiljsetrecipients: + rouilj, schlatterbeck
2022-11-23 20:33:03rouiljlinkissue2551242 messages
2022-11-23 20:33:03rouiljcreate