Fix tools linting

This commit is contained in:
jo 2021-09-07 23:10:21 +02:00
parent 4724a30937
commit 14d4012e8e
3 changed files with 9 additions and 9 deletions

3
tools/.pylintrc Normal file
View File

@ -0,0 +1,3 @@
[MESSAGES CONTROL]
disable=missing-module-docstring,
missing-function-docstring

View File

@ -1,10 +1,7 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import json
import sys
from argparse import ArgumentParser from argparse import ArgumentParser
from configparser import ConfigParser from configparser import ConfigParser
from os import PathLike
from pathlib import Path from pathlib import Path
from typing import Iterator, Set from typing import Iterator, Set
@ -62,7 +59,7 @@ def run():
choices=FORMATS, choices=FORMATS,
help="print packages list in a specific format.", help="print packages list in a specific format.",
default="list", default="list",
), )
parser.add_argument( parser.add_argument(
"-d", "-d",
"--dev", "--dev",

View File

@ -1,8 +1,8 @@
from pathlib import Path from pathlib import Path
from .packages import list_packages, load_packages from tools.packages import list_packages, load_packages
package_ini = """ PACKAGE_INI = """
[common] [common]
postgresql = buster postgresql = buster
# Some comment # Some comment
@ -20,13 +20,13 @@ result2 = {"apache2", "curl", "ffmpeg"}
def test_load_packages(): def test_load_packages():
assert load_packages(package_ini, "buster", False) == result1 assert load_packages(PACKAGE_INI, "buster", False) == result1
assert load_packages(package_ini, "bionic", True) == result2 assert load_packages(PACKAGE_INI, "bionic", True) == result2
def test_list_packages(tmp_path: Path): def test_list_packages(tmp_path: Path):
package_file = tmp_path / "packages.ini" package_file = tmp_path / "packages.ini"
package_file.write_text(package_ini) package_file.write_text(PACKAGE_INI)
assert list_packages([tmp_path, package_file], "buster", False) == result1 assert list_packages([tmp_path, package_file], "buster", False) == result1
assert list_packages([tmp_path, package_file], "bionic", True) == result2 assert list_packages([tmp_path, package_file], "bionic", True) == result2