Skip to content

Commit 24a1118

Browse files
Add typing in tests directory (#1163)
* Add typing in the tests/ directory * Add some assert for mypy's sake * Avoid adding mypy_extension by using pytest skip
1 parent 1ae89bf commit 24a1118

21 files changed

+1338
-1133
lines changed

tests/resources.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,27 +13,29 @@
1313

1414
import os
1515
import sys
16+
from typing import Optional
1617

1718
from astroid import builder
1819
from astroid.manager import AstroidManager
20+
from astroid.nodes.scoped_nodes import Module
1921

2022
DATA_DIR = os.path.join("testdata", "python3")
2123
RESOURCE_PATH = os.path.join(os.path.dirname(__file__), DATA_DIR, "data")
2224

2325

24-
def find(name):
26+
def find(name: str) -> str:
2527
return os.path.normpath(os.path.join(os.path.dirname(__file__), DATA_DIR, name))
2628

2729

28-
def build_file(path, modname=None):
30+
def build_file(path: str, modname: Optional[str] = None) -> Module:
2931
return builder.AstroidBuilder().file_build(find(path), modname)
3032

3133

3234
class SysPathSetup:
33-
def setUp(self):
35+
def setUp(self) -> None:
3436
sys.path.insert(0, find(""))
3537

36-
def tearDown(self):
38+
def tearDown(self) -> None:
3739
del sys.path[0]
3840
datadir = find("")
3941
for key in list(sys.path_importer_cache):

0 commit comments

Comments
 (0)