(self)
| 28 | |
| 29 | class TestBootstrap: |
| 30 | def test_import_string(self): |
| 31 | assert import_string("site.addsitedir") == addsitedir |
| 32 | assert import_string("site:addsitedir") == addsitedir |
| 33 | assert import_string("code.interact") == interact |
| 34 | assert import_string("code:interact") == interact |
| 35 | |
| 36 | # test things not already imported |
| 37 | func = import_string("os.path:join") |
| 38 | from os.path import join |
| 39 | |
| 40 | assert func == join |
| 41 | |
| 42 | # test something already imported |
| 43 | import shiv |
| 44 | |
| 45 | assert import_string("shiv") == shiv == sys.modules["shiv"] |
| 46 | |
| 47 | # test bogus imports raise properly |
| 48 | with pytest.raises(ImportError): |
| 49 | import_string("this is bogus!") |
| 50 | |
| 51 | def test_is_zipfile(self, zip_location): |
| 52 | with mock.patch.object(sys, "argv", [zip_location]): |
nothing calls this directly
no test coverage detected