How to use the shiv.bootstrap.import_string function in shiv

To help you get started, we’ve selected a few shiv 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 linkedin / shiv / test / test_bootstrap.py View on Github external
def test_import_string(self):
        assert import_string("site.addsitedir") == addsitedir
        assert import_string("site:addsitedir") == addsitedir
        assert import_string("code.interact") == interact
        assert import_string("code:interact") == interact

        # test things not already imported
        func = import_string("os.path:join")
        from os.path import join

        assert func == join

        # test something already imported
        import shiv

        assert import_string("shiv") == shiv == sys.modules["shiv"]

        # test bogus imports raise properly
        with pytest.raises(ImportError):
            import_string("this is bogus!")
github linkedin / shiv / test / test_bootstrap.py View on Github external
def test_import_string(self):
        assert import_string("site.addsitedir") == addsitedir
        assert import_string("site:addsitedir") == addsitedir
        assert import_string("code.interact") == interact
        assert import_string("code:interact") == interact

        # test things not already imported
        func = import_string("os.path:join")
        from os.path import join

        assert func == join

        # test something already imported
        import shiv

        assert import_string("shiv") == shiv == sys.modules["shiv"]

        # test bogus imports raise properly
        with pytest.raises(ImportError):
github linkedin / shiv / test / test_bootstrap.py View on Github external
assert import_string("code:interact") == interact

        # test things not already imported
        func = import_string("os.path:join")
        from os.path import join

        assert func == join

        # test something already imported
        import shiv

        assert import_string("shiv") == shiv == sys.modules["shiv"]

        # test bogus imports raise properly
        with pytest.raises(ImportError):
            import_string("this is bogus!")
github linkedin / shiv / test / test_bootstrap.py View on Github external
def test_import_string(self):
        assert import_string("site.addsitedir") == addsitedir
        assert import_string("site:addsitedir") == addsitedir
        assert import_string("code.interact") == interact
        assert import_string("code:interact") == interact

        # test things not already imported
        func = import_string("os.path:join")
        from os.path import join

        assert func == join

        # test something already imported
        import shiv

        assert import_string("shiv") == shiv == sys.modules["shiv"]

        # test bogus imports raise properly
        with pytest.raises(ImportError):
            import_string("this is bogus!")
github linkedin / shiv / test / test_bootstrap.py View on Github external
def test_import_string(self):
        assert import_string("site.addsitedir") == addsitedir
        assert import_string("site:addsitedir") == addsitedir
        assert import_string("code.interact") == interact
        assert import_string("code:interact") == interact

        # test things not already imported
        func = import_string("os.path:join")
        from os.path import join

        assert func == join

        # test something already imported
        import shiv

        assert import_string("shiv") == shiv == sys.modules["shiv"]

        # test bogus imports raise properly
        with pytest.raises(ImportError):
            import_string("this is bogus!")
github linkedin / shiv / test / test_bootstrap.py View on Github external
def test_import_string(self):
        assert import_string("site.addsitedir") == addsitedir
        assert import_string("site:addsitedir") == addsitedir
        assert import_string("code.interact") == interact
        assert import_string("code:interact") == interact

        # test things not already imported
        func = import_string("os.path:join")
        from os.path import join

        assert func == join

        # test something already imported
        import shiv

        assert import_string("shiv") == shiv == sys.modules["shiv"]

        # test bogus imports raise properly
        with pytest.raises(ImportError):
            import_string("this is bogus!")
github linkedin / shiv / test / test_bootstrap.py View on Github external
def test_import_string(self):
        assert import_string("site.addsitedir") == addsitedir
        assert import_string("site:addsitedir") == addsitedir
        assert import_string("code.interact") == interact
        assert import_string("code:interact") == interact

        # test things not already imported
        func = import_string("os.path:join")
        from os.path import join

        assert func == join

        # test something already imported
        import shiv

        assert import_string("shiv") == shiv == sys.modules["shiv"]

        # test bogus imports raise properly