forked from AtsushiSakai/PythonRobotics
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add mypy unit test (AtsushiSakai#621)
* add mypy unit test * add mypy unit test * add mypy unit test
- Loading branch information
1 parent
a13ef29
commit 82d97ce
Showing
5 changed files
with
58 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import os | ||
import subprocess | ||
|
||
import conftest | ||
|
||
SUBPACKAGE_LIST = [ | ||
"AerialNavigation", | ||
"ArmNavigation", | ||
"Bipedal", | ||
"Control", | ||
"Localization", | ||
"Mapping", | ||
"PathPlanning", | ||
"PathTracking", | ||
"SLAM", | ||
] | ||
|
||
|
||
def run_mypy(dir_name, project_path, config_path): | ||
res = subprocess.run( | ||
['mypy', | ||
'--config-file', | ||
config_path, | ||
'-p', | ||
dir_name], | ||
cwd=project_path, | ||
stdout=subprocess.PIPE, | ||
encoding='utf-8') | ||
return res.returncode, res.stdout | ||
|
||
|
||
def test(): | ||
project_dir_path = os.path.dirname( | ||
os.path.dirname(os.path.abspath(__file__))) | ||
print(f"{project_dir_path=}") | ||
|
||
config_path = os.path.join(project_dir_path, "mypy.ini") | ||
print(f"{config_path=}") | ||
|
||
for sub_package_name in SUBPACKAGE_LIST: | ||
rc, errors = run_mypy(sub_package_name, project_dir_path, config_path) | ||
if errors: | ||
print(errors) | ||
else: | ||
print("No lint errors found.") | ||
assert rc == 0 | ||
|
||
|
||
if __name__ == '__main__': | ||
conftest.run_this_test(__file__) |