| 1 | https://sources.debian.org/data/main/p/python-fixtures/3.0.0-4/debian/patches/remove-broken-monkey-patch-test.patch |
| 2 | |
| 3 | The last release was May 2016. This can be removed when the next release happens. |
| 4 | |
| 5 | Description: Remove broken monkey patch tests |
| 6 | Author: Thomas Goirand <[email protected]> |
| 7 | Bug-Debian: https://bugs.debian.org/973239 |
| 8 | Forwarded: no |
| 9 | Last-Update: 2020-11-12 |
| 10 | |
| 11 | |
| 12 | |
| 13 | class TestMonkeyPatch(testtools.TestCase |
| 14 | self._check_restored_static_or_class_method(oldmethod, oldmethod_inst, |
| 15 | C, 'foo_cls') |
| 16 | |
| 17 | - def test_patch_classmethod_with_classmethod(self): |
| 18 | - oldmethod = C.foo_cls |
| 19 | - oldmethod_inst = C().foo_cls |
| 20 | - fixture = MonkeyPatch( |
| 21 | - 'fixtures.tests._fixtures.test_monkeypatch.C.foo_cls', |
| 22 | - D.bar_cls_args) |
| 23 | - with fixture: |
| 24 | - cls, target_class = C.foo_cls() |
| 25 | - self.expectThat(cls, Is(D)) |
| 26 | - self.expectThat(target_class, Is(C)) |
| 27 | - cls, target_class = C().foo_cls() |
| 28 | - self.expectThat(cls, Is(D)) |
| 29 | - self.expectThat(target_class, Is(C)) |
| 30 | - self._check_restored_static_or_class_method(oldmethod, oldmethod_inst, |
| 31 | - C, 'foo_cls') |
| 32 | - |
| 33 | def test_patch_classmethod_with_function(self): |
| 34 | oldmethod = C.foo_cls |
| 35 | oldmethod_inst = C().foo_cls |
| 36 | class TestMonkeyPatch(testtools.TestCase |
| 37 | self._check_restored_static_or_class_method(oldmethod, oldmethod_inst, |
| 38 | C, 'foo_cls') |
| 39 | |
| 40 | - def test_patch_classmethod_with_boundmethod(self): |
| 41 | - oldmethod = C.foo_cls |
| 42 | - oldmethod_inst = C().foo_cls |
| 43 | - d = D() |
| 44 | - fixture = MonkeyPatch( |
| 45 | - 'fixtures.tests._fixtures.test_monkeypatch.C.foo_cls', |
| 46 | - d.bar_two_args) |
| 47 | - with fixture: |
| 48 | - slf, cls = C.foo_cls() |
| 49 | - self.expectThat(slf, Is(d)) |
| 50 | - self.expectThat(cls, Is(C)) |
| 51 | - slf, cls = C().foo_cls() |
| 52 | - self.expectThat(slf, Is(d)) |
| 53 | - self.expectThat(cls, Is(C)) |
| 54 | - self._check_restored_static_or_class_method(oldmethod, oldmethod_inst, |
| 55 | - C, 'foo_cls') |
| 56 | - |
| 57 | def test_patch_function_with_staticmethod(self): |
| 58 | oldmethod = fake_no_args |
| 59 | fixture = MonkeyPatch( |