diff --git a/.github/workflows/python-test.yml b/.github/workflows/python-test.yml index fe83306..dddf9cf 100644 --- a/.github/workflows/python-test.yml +++ b/.github/workflows/python-test.yml @@ -10,14 +10,8 @@ on: - '**.py' pull_request: branches: [ "main" ] - paths: - - '**.py' workflow_dispatch: - # inputs: - # branch_name: - # description: 'Test against to branch' - # required: true - # default: 'main' + permissions: contents: read @@ -33,12 +27,10 @@ jobs: python-version: "3.10" - name: Install dependencies run: | - python -m pip install --upgrade pip + python3 -m pip install --upgrade pip pip install . pip install -r requirements-dev.txt - - name: Lint with flake8 - run: flake8 --max-line-length=120 - - name: Run tests and collect coverage + - name: Collect coverage run: | coverage run --source=tests,clang_tools -m pytest coverage report -m diff --git a/requirements-dev.txt b/requirements-dev.txt index 8fa8b2f..14db2d8 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,3 +1,4 @@ coverage flake8 +pre-commit pytest diff --git a/tests/test_install.py b/tests/test_install.py index 02e007f..c3a2ac4 100644 --- a/tests/test_install.py +++ b/tests/test_install.py @@ -6,7 +6,7 @@ from clang_tools.install import clang_tools_binary_url -@pytest.mark.parametrize(('version', 'expected'), (('12', True), ('100', False))) +@pytest.mark.parametrize(('version', 'expected'), (('', True), ('100', False))) def test_clang_tools_exist(version, expected): assert clang_format_exist(version) == expected assert clang_tidy_exist(version) == expected @@ -18,7 +18,4 @@ def test_clang_tools_binary_url(): os = check_install_os() for tool in tools: ret = clang_tools_binary_url(tool, version) - if os == 'windows': - assert(f"{tool}-{version}_{os}-amd64.exe" in ret) - else: - assert(f"{tool}-{version}_{os}-amd64" in ret) + assert(f"{tool}-{version}_{os}-amd64" in ret) diff --git a/tests/test_main.py b/tests/test_main.py index 06b374e..d71aa6b 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -11,5 +11,3 @@ def test_main_install(argv, called, response): if called and not response: with pytest.raises(SystemExit): main() - else: - main()