How to use the unittest2.skip function in unittest2

To help you get started, we’ve selected a few unittest2 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 ErinMorelli / em-media-handler / tests / common.py View on Github external
def skipUnlessHasMod(module, submodule):
    try:
        Config._find_module(module, submodule)
    except ImportError:
        return unittest.skip("requires module {0}.{1}".format(
            module, submodule))
    else:
        return lambda func: func
github LMFDB / lmfdb / lmfdb / test_tensor_products.py View on Github external
    @unittest2.skip("Tests tensor product of artin rep and modular form L-functions -- skipping all tensor product tests ")
    def test_modform_artinrep(self):
        L1 = self.tc.get("ModularForm/GL2/Q/holomorphic/1/12/1/a/")
        assert "6048q^{6}" in L1.data
        # the following lines need changing after Artin rep
        # relabelling.  Perhaps "ArtinRepresentation/2.31.3t2.1c1"
        L2 = self.tc.get("ArtinRepresentation/2/31/1/")
        assert "(1,2,3)" in L2.data
        L = self.tc.get("TensorProducts/show/?obj1=ModularForm%2FGL2%2FQ%2Fholomorphic%2F1%2F12%2F0%2Fa%2F0&obj2=ArtinRepresentation%2F2%2F31%2F1%2F")
        assert '961' in L.data
github galaxyproject / planemo / tests / test_utils.py View on Github external
def skip_unless_module(module):
    available = True
    try:
        __import__(module)
    except ImportError:
        available = False
    if available:
        return lambda func: func
    template = "Module %s could not be loaded, dependent test skipped."
    return skip(template % module)
github aerospike / aerospike-admin / test / e2e / test_info.py View on Github external
    @unittest.skip("Skipping by default, to make it work please enable in setup_class also")
    def test_sindex(self):
        """
        This test will assert <b> info sindex </b> output for heading, headerline1, headerline2
        and no of row displayed in output
        TODO: test for values as well
        """
        exp_heading = '~~Secondary Index Information'
        exp_header = ['Node', 
                      'Index Name', 
                      'Namespace', 
                      'Set', 
                      'Bins', 
                      'Num Bins', 
                      'Bin Type', 
                      'State', 
                      'Sync State']
github dirn / Simon / tests / integration.py View on Github external
def skip_without_setting(setting):
    try:
        from . import integration_settings
    except ImportError:
        pass
    else:
        if hasattr(integration_settings, setting):
            return lambda f: f

    message = 'integration_settings.{0} was not found'.format(setting)
    return unittest.skip(message)
github Julian / jsonschema / test_jsonschema.py View on Github external
test["data"],
                            test["valid"],
                        )

                        test_name = "test_%s_%s_%s" % (
                            validating,
                            next(id),
                            re.sub(r"[\W ]+", "_", test["description"]),
                        )

                        if not PY3:
                            test_name = test_name.encode("utf-8")
                        a_test.__name__ = test_name

                        if skip is not None and skip(case):
                            a_test = unittest.skip("Checker not present.")(
                                a_test
                            )

                        assert not hasattr(test_class, test_name), test_name
                        setattr(test_class, test_name, a_test)

        return test_class
    return add_test_methods
github NeurodataWithoutBorders / pynwb / tests / integration / ui_write / base.py View on Github external
    @unittest.skip("deprecated")
    def test_build(self):
        """
        As of 20190110, this test has been deprecated. Maintaining hardcoded builder objects has become
        increasingly difficult, and offers little in the way of debugging and identifying problems
        """
        try:
            self.builder = self.setUpBuilder()
        except unittest.SkipTest:
            raise unittest.SkipTest("cannot run construct test for %s -- setUpBuilder not implemented" %
                                    self.__class__.__name__)
        self.maxDiff = None
        result = self.manager.build(self.container)
        # do something here to validate the result Builder against the spec
        self.assertDictEqual(result, self.builder)
github Scout24 / aws-monocyte / src / unittest / python / handler / s3_tests.py View on Github external
    @unittest2.skip("https://github.com/spulec/moto/issues/734")
    @mock_s3
    @mock_sts
    def test_bucket_delete_no_dry_run(self):
        self._given_bucket_mock('test-bucket', 'eu-west-1')
        self.s3_handler.dry_run = False
        resources = list(self.s3_handler.fetch_unwanted_resources())
        self.assertEqual(len(resources), 1)
        self.s3_handler.delete(resources[0])
        resources = list(self.s3_handler.fetch_unwanted_resources())
        self.assertEqual(len(resources), 0)
github datastax / python-driver / tests / integration / standard / test_query.py View on Github external
    @unittest.skip("Skipping until PYTHON-943 is resolved")
    def test_was_applied_batch_string(self):
        batch_statement = BatchStatement(BatchType.LOGGED)
        batch_statement.add_all(["INSERT INTO test3rf.lwt_clustering (k, c, v) VALUES (0, 0, 10);",
                                 "INSERT INTO test3rf.lwt_clustering (k, c, v) VALUES (0, 1, 10);",
                                 "INSERT INTO test3rf.lwt_clustering (k, c, v) VALUES (0, 2, 10);"], [None] * 3)
        self.session.execute(batch_statement)

        batch_str = """
                    BEGIN unlogged batch
                        INSERT INTO test3rf.lwt_clustering (k, c, v) VALUES (0, 0, 10) IF NOT EXISTS;
                        INSERT INTO test3rf.lwt_clustering (k, c, v) VALUES (0, 1, 10) IF NOT EXISTS;
                        INSERT INTO test3rf.lwt_clustering (k, c, v) VALUES (0, 2, 10) IF NOT EXISTS;
                    APPLY batch;
                    """
        result = self.session.execute(batch_str)
        self.assertFalse(result.was_applied)
github pydata / xarray / test / __init__.py View on Github external
def requires_pydap(test):
    return test if has_pydap else unittest.skip('requires pydap.client')(test)