Skip to content

Commit

Permalink
Fix linters
Browse files Browse the repository at this point in the history
  • Loading branch information
wwakabobik committed Aug 19, 2024
1 parent ff2c5aa commit 39f838a
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 14 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,16 @@ jobs:
pip install types-requests
pip install pytest
pip install faker
- name: Add 'testrail_api_reporter' to PYTHONPATH
run: echo "PYTHONPATH=$PYTHONPATH:$(pwd)/testrail_api_reporter:." >> $GITHUB_ENV
- name: Analysing the code with pylint
id: pylint
continue-on-error: true
run: |
changed_files=$(git diff --diff-filter=d --name-only $(git merge-base HEAD origin/master) HEAD | grep '\.py$') || true
echo $changed_files
if [ -n "$changed_files" ]; then
PYTHONPATH=$PYTHONPATH:. pylint $changed_files
pylint $changed_files
else
echo "No files changed, passing by"
exit 0
Expand All @@ -55,7 +57,7 @@ jobs:
echo $changed_files
if [ -n "$changed_files" ]; then
mkdir -p .mypy_cache
PYTHONPATH=$PYTHONPATH:. mypy $changed_files --install-types --non-interactive --ignore-missing-imports
mypy $changed_files --install-types --non-interactive --ignore-missing-imports
else
echo "No files changed, passing by"
exit 0
Expand All @@ -67,7 +69,7 @@ jobs:
changed_files=$(git diff --diff-filter=d --name-only $(git merge-base HEAD origin/master) HEAD | grep '\.py$') || true
echo $changed_files
if [ -n "$changed_files" ]; then
PYTHONPATH=$PYTHONPATH:. flake8 $changed_files
flake8 $changed_files
else
echo "No files changed, passing by"
exit 0
Expand All @@ -79,7 +81,7 @@ jobs:
changed_files=$(git diff --diff-filter=d --name-only $(git merge-base HEAD origin/master) HEAD | grep '\.py$') || true
echo $changed_files
if [ -n "$changed_files" ]; then
PYTHONPATH=$PYTHONPATH:. black --diff --check --color $changed_files
black --diff --check --color $changed_files
else
echo "No files changed, passing by"
exit 0
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/master_linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,16 @@ jobs:
pip install black
pip install types-xmltodict
pip install types-requests
- name: Add 'testrail_api_reporter' to PYTHONPATH
run: echo "PYTHONPATH=$PYTHONPATH:$(pwd)/testrail_api_reporter:." >> $GITHUB_ENV
- name: Analysing the code with pylint
id: pylint
continue-on-error: true
run: |
changed_files=$(git diff --diff-filter=d --name-only $(git merge-base HEAD origin/master) HEAD | grep '\.py$') || true
echo $changed_files
if [ -n "$changed_files" ]; then
PYTHONPATH=. pylint $changed_files
pylint $changed_files
else
echo "No files changed, passing by"
exit 0
Expand All @@ -49,7 +51,7 @@ jobs:
echo $changed_files
if [ -n "$changed_files" ]; then
mkdir -p .mypy_cache
PYTHONPATH=. mypy $changed_files --install-types --non-interactive --ignore-missing-imports
mypy $changed_files --install-types --non-interactive --ignore-missing-imports
else
echo "No files changed, passing by"
exit 0
Expand All @@ -61,7 +63,7 @@ jobs:
changed_files=$(git diff --diff-filter=d --name-only $(git merge-base HEAD origin/master) HEAD | grep '\.py$') || true
echo $changed_files
if [ -n "$changed_files" ]; then
PYTHONPATH=. flake8 $changed_files
flake8 $changed_files
else
echo "No files changed, passing by"
exit 0
Expand All @@ -73,7 +75,7 @@ jobs:
changed_files=$(git diff --diff-filter=d --name-only $(git merge-base HEAD origin/master) HEAD | grep '\.py$') || true
echo $changed_files
if [ -n "$changed_files" ]; then
PYTHONPATH=. black --diff --check --color $changed_files
black --diff --check --color $changed_files
else
echo "No files changed, passing by"
exit 0
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/master_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ jobs:
pip install pytest-xdist
pip install pytest-cov
pip install faker
- name: Add 'src' to PYTHONPATH
run: echo "PYTHONPATH=$PYTHONPATH:$(pwd)/src:." >> $GITHUB_ENV
- name: Add 'testrail_api_reporter' to PYTHONPATH
run: echo "PYTHONPATH=$PYTHONPATH:$(pwd)/testrail_api_reporter:." >> $GITHUB_ENV
- name: Execute tests
id: tests
run: pytest tests -n=auto --cov=testrail_api_reporter --cov-report=term --cov-report=xml:coverage.xml --cov-report=html
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ jobs:
pip install pytest-xdist
pip install pytest-cov
pip install faker
- name: Add 'src' to PYTHONPATH
run: echo "PYTHONPATH=$PYTHONPATH:$(pwd)/src:." >> $GITHUB_ENV
- name: Add 'testrail_api_reporter' to PYTHONPATH
run: echo "PYTHONPATH=$PYTHONPATH:$(pwd)/testrail_api_reporter:." >> $GITHUB_ENV
- name: Execute tests
id: tests
run: pytest tests -n=auto --cov=testrail_api_reporter --cov-report=term --cov-report=xml:coverage.xml --cov-fail-under=95
2 changes: 1 addition & 1 deletion tests/utils/test_reporter_utils_format_error.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Tests for the reporter_utils module, function 'format_error'"""

from ...testrail_api_reporter.utils.reporter_utils import format_error # pylint: disable=import-error,no-name-in-module
from ...testrail_api_reporter.utils.reporter_utils import format_error # pylint: disable=relative-beyond-top-level


def test_format_error_single_string():
Expand Down
2 changes: 1 addition & 1 deletion tests/utils/test_reporter_utils_upload_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from faker import Faker
from pytest import raises as pytest_raises

from testrail_api_reporter.utils.reporter_utils import upload_image # pylint: disable=import-error,no-name-in-module
from ...testrail_api_reporter.utils.reporter_utils import upload_image # pylint: disable=relative-beyond-top-level


test_filename = choice((f"{getcwd()}/tests/assets/test_image.png", f"{getcwd()}/tests/assets/test_image.jpeg"))
Expand Down

0 comments on commit 39f838a

Please sign in to comment.