How to use the nose2.main function in nose2

To help you get started, we’ve selected a few nose2 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github PQClean / PQClean / test / test_common.py View on Github external
for d in os.listdir('test_common'):
        primitive = re.sub(r"\.c$", "", d)
        if helpers.permit_test('common', None):
            yield check_common, primitive


def check_common(primitive):
    binname = os.path.join('..', 'bin', 'test_common_'+primitive)
    helpers.make(binname)
    helpers.run_subprocess([binname])


if __name__ == '__main__':
    try:
        import nose2
        nose2.main()
    except ImportError:
        import nose
        nose.runmodule()
github opengisch / qgis_setting_manager / test / test_setting.py View on Github external
# set value
        MySettings().set_value(name, new_value)
        self.assertEqual(MySettings().value(name), new_value)

        # remove setting
        MySettings().remove(name)
        self.assertEqual(MySettings().value(name), default_value)

        # bad values
        for bad_value in bad_values:
           self.assertFalse(MySettings().set_value(name, bad_value))


if __name__ == '__main__':
    nose2.main()
github akbargumbira / qgis_resources_sharing / test / gui / test_resource_sharing_dialog.py View on Github external
if index == 0:
                    self.assertEqual(
                        self.dialog.collection_proxy.accepted_status,
                        COLLECTION_ALL_STATUS)
                else:
                    self.assertEqual(
                        self.dialog.collection_proxy.accepted_status,
                        COLLECTION_INSTALLED_STATUS)
            else:
                # Tab Settings
                self.assertEqual(
                    self.dialog.stacked_menu_widget.currentIndex(), 1)


if __name__ == "__main__":
    nose2.main()
github akbargumbira / qgis_resources_sharing / test / test_symbol_xml_extractor.py View on Github external
)
        expected_colorramps = {
            'cr_colorbrewer': QgsVectorColorBrewerColorRampV2,
            'cr_gradient': QgsVectorGradientColorRampV2,
            'cr_random': QgsVectorRandomColorRampV2
        }
        self.assertEqual(len(extractor.colorramps), len(expected_colorramps))
        for colorramp in extractor.colorramps:
            self.assertTrue(
                isinstance(colorramp['colorramp'],
                           expected_colorramps[colorramp['name']])
            )


if __name__ == "__main__":
    nose2.main()
github gacarrillor / AppendFeaturesToLayer / tests / test_source_simple_polygons.py View on Github external
layer = res['TARGET_LAYER']
        self.assertEqual(layer.featureCount(), 0)  # Selected id has a hole, cannot be copied
        self.assertEqual(res[APPENDED_COUNT], 0)

        res = self.common._test_copy_selected('source_simple_polygons', 'target_simple_lines', 2)
        layer = res['TARGET_LAYER']
        self.assertEqual(layer.featureCount(), 1)
        self.assertEqual(res[APPENDED_COUNT], 1)

    @classmethod
    def tearDownClass(self):
        print('INFO: Tear down simple_pol-simple_lin')
        self.plugin.unload()

if __name__ == '__main__':
    nose2.main()
github akbargumbira / qgis_resources_sharing / test / resource_handler / test_symbol_resolver_mixin.py View on Github external
'collections', 'test_collection', 'preview')
        ]
        img_path = 'prev_1.png'
        fixed_path = resolve_path(img_path, collection_path, search_paths)
        expected_path = test_data_path(
            'collections', 'test_collection', 'preview', 'prev_1.png')
        self.assertEqual(fixed_path, expected_path)

        # Test case 7: not finding anywhere (return the original path)
        img_path = '/you/would/not/find/this/anywhere.png'
        fixed_path = resolve_path(img_path, collection_path, search_paths)
        self.assertEqual(fixed_path, img_path)


if __name__ == "__main__":
    nose2.main()
github ambrosejcarr / seqc / src / seqc / test_unit.py View on Github external
ua = seqc.arrays.UniqueReadArray(data, features, positions)
        self.assertTrue(ua.shape[0] == n_unique, 'Incorrect number of unique reads: '
                                                 '%d != %d' % (ua.shape[0], n_unique))

        # check if other filters are causing it to fail
        ua2 = ra.to_unique(3)
        self.assertTrue(ua2.shape == ua.shape, 'Incongruent number of unique reads: '
                                               '%d != %d' % (ua2.shape[0], ua.shape[0]))

        self.assertTrue(ua2.shape[0] == 21984)  # double check that the number is right


if __name__ == '__main__':
    import nose2
    # unittest.main()
    nose2.main()
github gacarrillor / AppendFeaturesToLayer / tests / test_parameter_errors.py View on Github external
'ACTION_ON_DUPLICATE': 0})  # No action

        self.assertIsNone(res['TARGET_LAYER'])  # The algorithm doesn't run, and doesn't give an output
        self.assertIsNone(res[APPENDED_COUNT])
        self.assertIsNone(res[UPDATED_COUNT])
        self.assertIsNone(res[SKIPPED_COUNT])

        self.assertEqual(layer.featureCount(), 2)

    @classmethod
    def tearDownClass(self):
        print('INFO: Tear down test_parameter_errors')
        self.plugin.unload()

if __name__ == '__main__':
    nose2.main()
github opengisch / qgis_setting_manager / test / test_dialog.py View on Github external
self.assertEqual(setting_widget.widget_value(), default_value)

        # set the widget with new value
        setting_widget.set_widget_value(new_value)

        # check that setting has been automatically updated
        self.assertEqual(MySettings().value(setting_name), new_value)

        self.dlg.close()

        # reset setting
        MySettings().remove(setting_name)


if __name__ == '__main__':
    nose2.main()
github ambrosejcarr / seqc / src / seqc / test_functional.py View on Github external
seqc.log.info('SEQC working directory: %s' % os.getcwd())
        seqc.log.info('Passed command line arguments: %s' %
                      json.dumps(arg_copy, separators=(',', ': '), indent=4))

        func = kwargs['func']
        func(**kwargs)

    except:
        seqc.log.exception()
        raise


if __name__ == "__main__":
    seqc.log.setup_logger()
    try:
        nose2.main(exit=False, module=__name__, verbosity=5)
    except:
        seqc.log.exception()
        raise