[issue24928] mock.patch.dict spoils order of items in collections.OrderedDict

Karthikeyan Singaravelan report at bugs.python.org
Sat Jan 5 08:58:38 EST 2019


Karthikeyan Singaravelan <tir.karthi at gmail.com> added the comment:

Can you please post the error and the command to run the test? On applying the patch on master I cannot see any errors with below commands : 

# Applying the patch with only test

$ wget https://bugs.python.org/file40488/issue24928.patch
$ git apply issue24928.patch
$ git checkout Lib/unittest/mock.py # Only tests are needed

# Running tests with no errors

* ./python.exe Lib/unittest/test/testmock/ 
* ./python.exe -m unittest -v unittest.test.testmock
* ./python.exe -m unittest -v unittest.test.testmock.testpatch

I can see an error running the file separately using `./python.exe Lib/unittest/test/testmock/testpatch.py` but I don't think it's related to the patch : 

./python.exe Lib/unittest/test/testmock/testpatch.py
............................................................................................F....
======================================================================
FAIL: test_special_attrs (__main__.PatchTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "Lib/unittest/test/testmock/testpatch.py", line 1870, in test_special_attrs
    self.assertEqual(foo.__module__, 'unittest.test.testmock.testpatch')
AssertionError: '__main__' != 'unittest.test.testmock.testpatch'
- __main__
+ unittest.test.testmock.testpatch


----------------------------------------------------------------------
Ran 97 tests in 0.704s

FAILED (failures=1)

Build info

$ ./python.exe
Python 3.8.0a0 (heads/master:47a2fced84, Jan  4 2019, 10:36:15)

----------
versions:  -Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue24928>
_______________________________________


More information about the Python-bugs-list mailing list