| 1 | n/a | import abc |
|---|
| 2 | n/a | |
|---|
| 3 | n/a | |
|---|
| 4 | n/a | class FinderTests(metaclass=abc.ABCMeta): |
|---|
| 5 | n/a | |
|---|
| 6 | n/a | """Basic tests for a finder to pass.""" |
|---|
| 7 | n/a | |
|---|
| 8 | n/a | @abc.abstractmethod |
|---|
| 9 | n/a | def test_module(self): |
|---|
| 10 | n/a | # Test importing a top-level module. |
|---|
| 11 | n/a | pass |
|---|
| 12 | n/a | |
|---|
| 13 | n/a | @abc.abstractmethod |
|---|
| 14 | n/a | def test_package(self): |
|---|
| 15 | n/a | # Test importing a package. |
|---|
| 16 | n/a | pass |
|---|
| 17 | n/a | |
|---|
| 18 | n/a | @abc.abstractmethod |
|---|
| 19 | n/a | def test_module_in_package(self): |
|---|
| 20 | n/a | # Test importing a module contained within a package. |
|---|
| 21 | n/a | # A value for 'path' should be used if for a meta_path finder. |
|---|
| 22 | n/a | pass |
|---|
| 23 | n/a | |
|---|
| 24 | n/a | @abc.abstractmethod |
|---|
| 25 | n/a | def test_package_in_package(self): |
|---|
| 26 | n/a | # Test importing a subpackage. |
|---|
| 27 | n/a | # A value for 'path' should be used if for a meta_path finder. |
|---|
| 28 | n/a | pass |
|---|
| 29 | n/a | |
|---|
| 30 | n/a | @abc.abstractmethod |
|---|
| 31 | n/a | def test_package_over_module(self): |
|---|
| 32 | n/a | # Test that packages are chosen over modules. |
|---|
| 33 | n/a | pass |
|---|
| 34 | n/a | |
|---|
| 35 | n/a | @abc.abstractmethod |
|---|
| 36 | n/a | def test_failure(self): |
|---|
| 37 | n/a | # Test trying to find a module that cannot be handled. |
|---|
| 38 | n/a | pass |
|---|
| 39 | n/a | |
|---|
| 40 | n/a | |
|---|
| 41 | n/a | class LoaderTests(metaclass=abc.ABCMeta): |
|---|
| 42 | n/a | |
|---|
| 43 | n/a | @abc.abstractmethod |
|---|
| 44 | n/a | def test_module(self): |
|---|
| 45 | n/a | """A module should load without issue. |
|---|
| 46 | n/a | |
|---|
| 47 | n/a | After the loader returns the module should be in sys.modules. |
|---|
| 48 | n/a | |
|---|
| 49 | n/a | Attributes to verify: |
|---|
| 50 | n/a | |
|---|
| 51 | n/a | * __file__ |
|---|
| 52 | n/a | * __loader__ |
|---|
| 53 | n/a | * __name__ |
|---|
| 54 | n/a | * No __path__ |
|---|
| 55 | n/a | |
|---|
| 56 | n/a | """ |
|---|
| 57 | n/a | pass |
|---|
| 58 | n/a | |
|---|
| 59 | n/a | @abc.abstractmethod |
|---|
| 60 | n/a | def test_package(self): |
|---|
| 61 | n/a | """Loading a package should work. |
|---|
| 62 | n/a | |
|---|
| 63 | n/a | After the loader returns the module should be in sys.modules. |
|---|
| 64 | n/a | |
|---|
| 65 | n/a | Attributes to verify: |
|---|
| 66 | n/a | |
|---|
| 67 | n/a | * __name__ |
|---|
| 68 | n/a | * __file__ |
|---|
| 69 | n/a | * __package__ |
|---|
| 70 | n/a | * __path__ |
|---|
| 71 | n/a | * __loader__ |
|---|
| 72 | n/a | |
|---|
| 73 | n/a | """ |
|---|
| 74 | n/a | pass |
|---|
| 75 | n/a | |
|---|
| 76 | n/a | @abc.abstractmethod |
|---|
| 77 | n/a | def test_lacking_parent(self): |
|---|
| 78 | n/a | """A loader should not be dependent on it's parent package being |
|---|
| 79 | n/a | imported.""" |
|---|
| 80 | n/a | pass |
|---|
| 81 | n/a | |
|---|
| 82 | n/a | @abc.abstractmethod |
|---|
| 83 | n/a | def test_state_after_failure(self): |
|---|
| 84 | n/a | """If a module is already in sys.modules and a reload fails |
|---|
| 85 | n/a | (e.g. a SyntaxError), the module should be in the state it was before |
|---|
| 86 | n/a | the reload began.""" |
|---|
| 87 | n/a | pass |
|---|
| 88 | n/a | |
|---|
| 89 | n/a | @abc.abstractmethod |
|---|
| 90 | n/a | def test_unloadable(self): |
|---|
| 91 | n/a | """Test ImportError is raised when the loader is asked to load a module |
|---|
| 92 | n/a | it can't.""" |
|---|
| 93 | n/a | pass |
|---|