def setUp(self):
        super(TestFlakyNosePlugin, self).setUp()

        self._mock_test_result = MagicMock()
        self._mock_stream = None
        self._flaky_plugin = flaky_nose_plugin.FlakyPlugin()
        self._mock_nose_result = Mock(flaky_nose_plugin.TextTestResult)
        self._flaky_plugin.prepareTestResult(self._mock_nose_result)
        self._mock_test = MagicMock(name='flaky_plugin_test')
        self._mock_test_case = MagicMock(name='flaky_plugin_test_case',
                                         spec=TestCase)
        self._mock_test_case.address = MagicMock()
        self._mock_test_case.test = self._mock_test
        self._mock_test_module_name = 'test_module'
        self._mock_test_class_name = 'TestClass'
        self._mock_test_method_name = 'test_method'
        self._mock_test_names = '{0}:{1}.{2}'.format(
            self._mock_test_module_name, self._mock_test_class_name,
            self._mock_test_method_name)
        self._mock_exception = Exception('Error in {0}'.format(
            self._mock_test_method_name))
        self._mock_stack_trace = ''
        self._mock_exception_type = Exception
        self._mock_error = (self._mock_exception_type, self._mock_exception,
                            self._mock_stack_trace)
        self._mock_test_method = MagicMock(
            name=self._mock_test_method_name,
            spec=['__call__'] + list(FlakyNames().items()),
        )
        setattr(
            self._mock_test,
            self._mock_test_method_name,
            self._mock_test_method,
        )
Exemple #2
0
    def setUp(self):
        super(TestFlakyPlugin, self).setUp()

        test_base_mod = 'flaky._flaky_plugin'
        self._mock_test_result = MagicMock()
        self._mock_stream = MagicMock(spec=StringIO)
        with patch.object(flaky_nose_plugin, 'TextTestResult') as flaky_result:
            with patch(test_base_mod + '.StringIO') as string_io:
                string_io.return_value = self._mock_stream
                flaky_result.return_value = self._mock_test_result
                self._flaky_plugin = flaky_nose_plugin.FlakyPlugin()
        self._mock_nose_result = Mock(flaky_nose_plugin.TextTestResult)
        self._flaky_plugin.prepareTestResult(self._mock_nose_result)
        self._mock_test = MagicMock(name='flaky_plugin_test')
        self._mock_test_case = MagicMock(name='flaky_plugin_test_case',
                                         spec=TestCase)
        self._mock_test_case.address = MagicMock()
        self._mock_test_case.test = self._mock_test
        self._mock_test_module_name = 'test_module'
        self._mock_test_class_name = 'TestClass'
        self._mock_test_method_name = 'test_method'
        self._mock_test_names = '{0}:{1}.{2}'.format(
            self._mock_test_module_name, self._mock_test_class_name,
            self._mock_test_method_name)
        self._mock_exception = Exception('Error in {0}'.format(
            self._mock_test_method_name))
        self._mock_stack_trace = ''
        self._mock_exception_type = Exception
        self._mock_error = (self._mock_exception_type, self._mock_exception,
                            self._mock_stack_trace)
        self._mock_test_method = MagicMock(
            name=self._mock_test_method_name,
            spec=['__call__'] + list(FlakyNames().items()),
        )
        setattr(
            self._mock_test,
            self._mock_test_method_name,
            self._mock_test_method,
        )
Exemple #3
0
        "--verbose",
        "--with-doctest",
        "--with-flaky",
        "--with-coverage",
        "--cover-html",
        "--cover-package",
        "cmdx",
        "--cover-erase",
        "--cover-tests",
        "tests.py",
        "test_performance.py",
        "cmdx.py",
    ])

    result = nose.main(
        argv=argv,
        addplugins=[flaky.FlakyPlugin()],

        # We'll exit in our own way,
        # since Maya typically enjoys throwing
        # segfaults during cleanup of normal exits
        exit=False)

    if os.getenv("TRAVIS_JOB_ID"):
        import coveralls
        coveralls.wear()
    else:
        sys.stdout.write("Skipping coveralls\n")

    # Good night Maya, you aweful segfaulter
    os._exit(0 if result.success else 1)
Exemple #4
0
if __name__ == "__main__":
    print("Initialising Maya..")
    from maya import standalone, cmds
    standalone.initialize()
    cmds.loadPlugin("matrixNodes", quiet=True)

    argv = sys.argv[:]
    argv.extend([
        "--verbose",
        "--with-doctest",
        "--with-flaky",
        "--with-coverage",
        "--cover-html",
        "--cover-package",
        "cmdx",
        "--cover-erase",
        "--cover-tests",
        "tests.py",
        "test_performance.py",
        "cmdx.py",
    ])

    nose.main(argv=argv, addplugins=[flaky.FlakyPlugin()])

    if os.getenv("TRAVIS_JOB_ID"):
        import coveralls
        coveralls.wear()
    else:
        sys.stdout.write("Skipping coveralls")