File tree Expand file tree Collapse file tree 9 files changed +16
-16
lines changed Expand file tree Collapse file tree 9 files changed +16
-16
lines changed Original file line number Diff line number Diff line change 2
2
import unittest
3
3
4
4
5
- class FinderTests (unittest . TestCase , metaclass = abc .ABCMeta ):
5
+ class FinderTests (metaclass = abc .ABCMeta ):
6
6
7
7
"""Basic tests for a finder to pass."""
8
8
@@ -39,7 +39,7 @@ def test_failure(self):
39
39
pass
40
40
41
41
42
- class LoaderTests (unittest . TestCase , metaclass = abc .ABCMeta ):
42
+ class LoaderTests (metaclass = abc .ABCMeta ):
43
43
44
44
@abc .abstractmethod
45
45
def test_module (self ):
Original file line number Diff line number Diff line change 6
6
import sys
7
7
import unittest
8
8
9
- class FinderTests (abc .FinderTests ):
9
+ class FinderTests (unittest . TestCase , abc .FinderTests ):
10
10
11
11
"""Test find_module() for built-in modules."""
12
12
@@ -46,10 +46,5 @@ def test_ignore_path(self):
46
46
47
47
48
48
49
- def test_main ():
50
- from test .support import run_unittest
51
- run_unittest (FinderTests )
52
-
53
-
54
49
if __name__ == '__main__' :
55
- test_main ()
50
+ unittest . main ()
Original file line number Diff line number Diff line change 9
9
import unittest
10
10
11
11
12
- class LoaderTests (abc .LoaderTests ):
12
+ class LoaderTests (unittest . TestCase , abc .LoaderTests ):
13
13
14
14
"""Test load_module() for built-in modules."""
15
15
Original file line number Diff line number Diff line change 4
4
5
5
import unittest
6
6
7
- class FinderTests (abc .FinderTests ):
7
+ class FinderTests (unittest . TestCase , abc .FinderTests ):
8
8
9
9
"""Test the finder for extension modules."""
10
10
Original file line number Diff line number Diff line change 8
8
import unittest
9
9
10
10
11
- class LoaderTests (abc .LoaderTests ):
11
+ class LoaderTests (unittest . TestCase , abc .LoaderTests ):
12
12
13
13
"""Test load_module() for extension modules."""
14
14
Original file line number Diff line number Diff line change 4
4
import unittest
5
5
6
6
7
- class FinderTests (abc .FinderTests ):
7
+ class FinderTests (unittest . TestCase , abc .FinderTests ):
8
8
9
9
"""Test finding frozen modules."""
10
10
Original file line number Diff line number Diff line change 7
7
import types
8
8
9
9
10
- class LoaderTests (abc .LoaderTests ):
10
+ class LoaderTests (unittest . TestCase , abc .LoaderTests ):
11
11
12
12
def test_module (self ):
13
13
with util .uncache ('__hello__' ), captured_stdout () as stdout :
Original file line number Diff line number Diff line change 19
19
from test .support import make_legacy_pyc , unload
20
20
21
21
22
- class SimpleTest (unittest .TestCase ):
22
+ class SimpleTest (unittest .TestCase , abc . LoaderTests ):
23
23
24
24
"""Should have no issue importing a source module [basic]. And if there is
25
25
a syntax error, it should raise a SyntaxError [syntax error].
@@ -177,6 +177,11 @@ def test_timestamp_overflow(self):
177
177
# The pyc file was created.
178
178
os .stat (compiled )
179
179
180
+ def test_unloadable (self ):
181
+ loader = machinery .SourceFileLoader ('good name' , {})
182
+ with self .assertRaises (ImportError ):
183
+ loader .load_module ('bad name' )
184
+
180
185
181
186
class BadBytecodeTest (unittest .TestCase ):
182
187
Original file line number Diff line number Diff line change 13
13
import warnings
14
14
15
15
16
- class FinderTests (abc .FinderTests ):
16
+ class FinderTests (unittest . TestCase , abc .FinderTests ):
17
17
18
18
"""For a top-level module, it should just be found directly in the
19
19
directory being searched. This is true for a directory with source
You can’t perform that action at this time.
0 commit comments