File tree Expand file tree Collapse file tree 2 files changed +12
-17
lines changed
Expand file tree Collapse file tree 2 files changed +12
-17
lines changed Original file line number Diff line number Diff line change @@ -30,8 +30,11 @@ def run_case(self, testcase: DataDrivenTestCase) -> None:
3030 options .show_traceback = True
3131 options .allow_empty_bodies = True
3232 options .fixed_format_cache = True
33+ fnam = os .path .join (self .base_path , "main.py" )
34+ with open (fnam , "w" ) as f :
35+ f .write (src )
3336 result = build .build (
34- sources = [BuildSource ("main" , None , src )],
37+ sources = [BuildSource (fnam , "main" )],
3538 options = options ,
3639 alt_lib_path = test_temp_dir ,
3740 )
@@ -41,7 +44,7 @@ def run_case(self, testcase: DataDrivenTestCase) -> None:
4144 cache_dir = os .path .join (".mypy_cache" , f"{ major } .{ minor } " )
4245
4346 for module in result .files :
44- if module in ("builtins" , "typing" , "_typeshed" , "__main__" ):
47+ if module in ("builtins" , "typing" , "_typeshed" ):
4548 continue
4649 fnam = os .path .join (cache_dir , f"{ module } .data.ff" )
4750 with open (fnam , "rb" ) as f :
Original file line number Diff line number Diff line change 44-- full test coverage.
55
66[case testExportVar]
7- import m
8-
9- [file m.py]
107x = 0
11-
128[out]
139{
1410 ".class": "MypyFile",
15- "_fullname": "m ",
11+ "_fullname": "main ",
1612 "names": {
1713 ".class": "SymbolTable",
1814 "x": {
2117 "node": {
2218 ".class": "Var",
2319 "name": "x",
24- "fullname": "m .x",
20+ "fullname": "main .x",
2521 "type": {
2622 ".class": "Instance",
2723 "type_ref": null,
@@ -43,25 +39,21 @@ x = 0
4339}
4440
4541[case testExportClass]
46- import m
47-
48- [file m.py]
4942class C:
5043 x: int
51-
5244[out]
5345{
5446 ".class": "MypyFile",
55- "_fullname": "m ",
47+ "_fullname": "main ",
5648 "names": {
5749 ".class": "SymbolTable",
5850 "C": {
5951 ".class": "SymbolTableNode",
6052 "kind": "Gdef",
6153 "node": {
6254 ".class": "TypeInfo",
63- "module_name": "m ",
64- "fullname": "m .C",
55+ "module_name": "main ",
56+ "fullname": "main .C",
6557 "names": {
6658 ".class": "SymbolTable",
6759 "x": {
@@ -70,7 +62,7 @@ class C:
7062 "node": {
7163 ".class": "Var",
7264 "name": "x",
73- "fullname": "m .C.x",
65+ "fullname": "main .C.x",
7466 "type": {
7567 ".class": "Instance",
7668 "type_ref": null,
@@ -87,7 +79,7 @@ class C:
8779 "defn": {
8880 ".class": "ClassDef",
8981 "name": "C",
90- "fullname": "m .C",
82+ "fullname": "main .C",
9183 "type_vars": []
9284 },
9385 "abstract_attributes": [],
You can’t perform that action at this time.
0 commit comments