Ejemplo n.º 1
0
    def test08_runNative_in_subfolder_works_as_expected(self):

        settings = vfxtest.collectSettings(['--target', './python'])
        vfxtest.prepareTestEnvironment(settings)

        vfxtest.runNative(settings=settings)

        self.assertEqual(settings['files_run'], 1)
        self.assertEqual(settings['tests_run'], 3)
        self.assertEqual(settings['errors'], 0)
Ejemplo n.º 2
0
    def test07_runNative_with_limit_works_as_expected(self):

        settings = vfxtest.collectSettings(['--limit', '1'])
        vfxtest.prepareTestEnvironment(settings)

        vfxtest.runNative(settings=settings, use_coverage=False)

        self.assertEqual(settings['files_run'], 1)
        self.assertEqual(settings['tests_run'], 3)
        self.assertEqual(settings['errors'], 0)
Ejemplo n.º 3
0
    def test09_runNative_no_tests_at_all_does_not_try_to_report_coverage(self):

        settings = vfxtest.collectSettings(['--target', './python'])
        settings['filter_tokens'].append('does-not-get-matched')
        vfxtest.prepareTestEnvironment(settings)

        vfxtest.runNative(settings=settings)

        self.assertEqual(settings['files_run'], 0)
        self.assertEqual(settings['tests_run'], 0)
        self.assertEqual(settings['errors'], 0)
Ejemplo n.º 4
0
    def test02_runNative_with_filter_tokens_runs_successfully(self):

        settings = vfxtest.collectSettings([
            '--target',
            '.',
            '_01',
        ])
        vfxtest.prepareTestEnvironment(settings)

        vfxtest.runNative(settings=settings, use_coverage=False)
        self.assertEqual(settings['files_run'], 1)
        self.assertEqual(settings['tests_run'], 3)
        self.assertEqual(settings['errors'], 0)
Ejemplo n.º 5
0
    def test10_runNative_with_failfast_stops_on_first_error(self):

        settings = vfxtest.collectSettings(['--failfast', 'true'])
        print(settings['failfast'])
        print(settings['target'])

        vfxtest.prepareTestEnvironment(settings)
        with mock.patch('awesome_module.buzz', side_effect=Exception()):
            vfxtest.runNative(settings=settings, use_coverage=False)

        self.assertEqual(settings['files_run'], 1)
        self.assertEqual(settings['tests_run'], 2)
        self.assertEqual(settings['errors'], 1)
Ejemplo n.º 6
0
    def test01_runNative_runs_successfully(self):

        settings = vfxtest.collectSettings()
        vfxtest.prepareTestEnvironment(settings)

        cov_file = os.path.abspath('{}/.coverage.native'.format(
            settings['output_folder']))
        if os.path.exists(cov_file):
            os.remove(cov_file)
        vfxtest.runNative(settings=settings, use_coverage=True)

        self.assertEqual(settings['files_run'], 2)
        self.assertEqual(settings['tests_run'], 6)
        self.assertEqual(settings['errors'], 0)
        self.assertTrue(os.path.exists(cov_file))
Ejemplo n.º 7
0
    def test03_combineCoverages_works_as_expected(self):

        settings = vfxtest.collectSettings([
            '_02',
        ])
        vfxtest.prepareTestEnvironment(settings)

        settings['context'] = 'differentContext'
        vfxtest.runNative(settings=settings)
        self.assertEqual(settings['files_run'], 1)
        self.assertEqual(settings['tests_run'], 3)
        self.assertTrue(
            os.path.exists('{}/.coverage.differentContext'.format(
                settings['output_folder'])))

        settings = vfxtest.collectSettings()
        vfxtest.combineCoverages(settings)

        self.assertFalse(
            os.path.exists('{}/.coverage.differentContext'.format(
                settings['output_folder'])))
        self.assertTrue(
            os.path.exists('{}/.coverage'.format(settings['output_folder'])))