• Yanghan Wang's avatar
    making bootstrap more robust · 1f45cf04
    Yanghan Wang authored
    Summary:
    X-link: https://github.com/facebookresearch/mobile-vision/pull/81
    
    Pull Request resolved: https://github.com/facebookresearch/d2go/pull/283
    
    - add `MoreMagicMock`, which handles inheritance and comparison.
    - also support lazy registering mocked objects (has to be `MoreMagicMock`).
    - don't need to skip `skip files that doesn't contain ".register()" call` since we can handle most files pretty well now.
    - also mock the open
    - delay the import for `from detectron2.utils.testing import assert_instances_allclose`; for some reason python is doing magic things if you import anything starting with `assert`, so the mocked import doesn't work.
    - makes log function nicer.
    
    Reviewed By: tglik
    
    Differential Revision: D36798327
    
    fbshipit-source-id: ccda7e7583b95a24f3dde1bbe0468593dacb8663
    1f45cf04
bootstrap.py 9.02 KB