예제 #1
0
    def test_main(self):
        with patch('find_forks.find_forks.find_forks',
                   return_value=None) as find_forks_mock:
            main()
            sent_args = CONFIG.copy()
            sent_args.update({'user': None, 'repo': None, 'no_fetch': False})
            find_forks_mock.assert_called_once_with(**sent_args)

            # Test __version__ exceptions.
            find_forks_mock = MagicMock(side_effect=SystemError())
            del find_forks_mock.__version__
            modules = {'find_forks.__init__': find_forks_mock}
            with patch.dict('sys.modules', modules):
                self.assertRaises(ImportError, main)
예제 #2
0
    def test_main(self):
        with patch('find_forks.find_forks.find_forks', return_value=None) as find_forks_mock:
            main()
            sent_args = CONFIG.copy()
            sent_args.update({'user': None, 'repo': None, 'no_fetch': False})
            find_forks_mock.assert_called_once_with(**sent_args)

            # Test __version__ exceptions.
            find_forks_mock = MagicMock(side_effect=SystemError())
            del find_forks_mock.__version__
            modules = {
                'find_forks.__init__': find_forks_mock
            }
            with patch.dict('sys.modules', modules):
                self.assertRaises(ImportError, main)
예제 #3
0
# coding: utf-8
"""Finds all forks of user/repo on github from the console."""
from __future__ import absolute_import, division, print_function, unicode_literals

from six import PY3

try:
    from .find_forks.find_forks import main
except (SystemError, ValueError) as ex:
    if PY3 and isinstance(ex, SystemError) or isinstance(ex, ValueError):
        from find_forks.find_forks import main
    else:
        raise

if __name__ == '__main__':
    main()