Skip to content

Commit

Permalink
Replace print with logger (#44)
Browse files Browse the repository at this point in the history
* Replace print with logger

* Update to 1.4.10

* Update to 1.4.11

* Update to 1.4.11

* Update to 1.4.11

* Update to 1.4.11

* Update to 1.4.11

* Update to 1.4.11

* Update to 1.4.11

* Update to 1.4.11

* Update to 1.4.11

* Update GA and README.md

* Update GA and README.md

* Update GA and README.md

* Update GA and README.md

* Rearrange project structure, add tests for upload_image

* Rearrange project structure, add tests for upload_image

* Rearrange project structure, add tests for upload_image

* Fix linters

* Fix linters

* Fix linters

* Fix linters

* Fix linters

* Fix linters

* Fix linters

* Add test_reporter_utils_delete_file.py

* Add test_reporter_utils_delete_file.py

* 100% cover "reporter_utils"

* 100% cover "reporter_utils"

* 100% cover "reporter_utils"

* 100% cover "reporter_utils"

* Add explicit coding (utf-8)

* Added test_reporter_utils_case_stat.py

* Added test_reporter_utils_csv_parser_*.py

* Added test_reporter_utils_logger_config.py

* Added test_engines_plotly_reporter_draw_automation_state_report.py

* Added test_engines_plotly_reporter_draw_test_case_by_area.py

* Added test_engines_plotly_reporter_draw_test_case_by_priority.py.py

* Variate more params for draw functions

* Add test_engines_plotly_reporter_draw_history_state_chart.py

* Fix test against missed filename

* Linter fixes

* Linter fixes

* Linter fixes

* Linter fixes

* Add explicit coding (utf-8)

* Linter fixes

* Linter fixes

* Linter fixes

* Linter fixes

* Linter fixes

* Linter fixes
  • Loading branch information
wwakabobik authored Aug 30, 2024
1 parent 6a7c1d4 commit cc1cc44
Show file tree
Hide file tree
Showing 51 changed files with 2,086 additions and 446 deletions.
35 changes: 24 additions & 11 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Linters
name: Linters-PR

on:
push:
Expand Down Expand Up @@ -27,20 +27,25 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pylint reorder-python-imports
pip install mypy reorder-python-imports
pip install wemake-python-styleguide reorder-python-imports
pip install black reorder-python-imports
pip install pylint
pip install mypy
pip install wemake-python-styleguide
pip install black
pip install types-xmltodict
pip install types-requests
pip install pytest
pip install faker
pip install pillow
- 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 @@ -52,7 +57,8 @@ 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=. mypy $changed_files --install-types --non-interactive --ignore-missing-imports
mkdir -p .mypy_cache
mypy $changed_files --install-types --non-interactive --ignore-missing-imports --explicit-package-bases
else
echo "No files changed, passing by"
exit 0
Expand All @@ -64,7 +70,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 @@ -76,14 +82,21 @@ 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
fi
- name: Check runner state
run: |
if [[ "${{ steps.pylint.outcome }}" == "failure" || "${{ steps.black.outcome }}" == "failure" || "${{ steps.mypy.outcome }}" == "failure" ]]; then
echo "Linters failed, refer to related sections for info"
failed_steps=()
if [[ "${{ steps.pylint.outcome }}" == "failure" ]]; then failed_steps+=("Pylint"); fi
if [[ "${{ steps.black.outcome }}" == "failure" ]]; then failed_steps+=("Black"); fi
if [[ "${{ steps.mypy.outcome }}" == "failure" ]]; then failed_steps+=("Mypy"); fi
if [ ${#failed_steps[@]} -ne 0 ]; then
echo "Failed: ${failed_steps[*]}"
exit 1
else
echo "All passed, well done, bro!"
fi
99 changes: 99 additions & 0 deletions .github/workflows/master_linters.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: Linters
on:
push:
branches:
- 'master'

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pylint
pip install mypy
pip install wemake-python-styleguide
pip install black
pip install types-xmltodict
pip install types-requests
pip install pytest
pip install faker
pip install pillow
- 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
pylint $changed_files
else
echo "No files changed, passing by"
exit 0
fi
- name: Analysing the code with mypy
id: mypy
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
mkdir -p .mypy_cache
mypy $changed_files --install-types --non-interactive --ignore-missing-imports --explicit-package-bases
else
echo "No files changed, passing by"
exit 0
fi
- name: Check code with flake8
id: flake8
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
flake8 $changed_files
else
echo "No files changed, passing by"
exit 0
fi
- name: Check code with Black
id: black
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
black --diff --check --color $changed_files
else
echo "No files changed, passing by"
exit 0
fi
- name: Check runner state
run: |
failed_steps=()
if [[ "${{ steps.pylint.outcome }}" == "failure" ]]; then failed_steps+=("Pylint"); fi
if [[ "${{ steps.black.outcome }}" == "failure" ]]; then failed_steps+=("Black"); fi
if [[ "${{ steps.mypy.outcome }}" == "failure" ]]; then failed_steps+=("Mypy"); fi
if [ ${#failed_steps[@]} -ne 0 ]; then
echo "Failed: ${failed_steps[*]}"
exit 1
else
echo "All passed, well done, bro!"
fi
46 changes: 46 additions & 0 deletions .github/workflows/master_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Tests
on:
push:
branches:
- 'master'
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest
pip install pytest-xdist
pip install pytest-cov
pip install faker
pip install pillow
- 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
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4.0.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: wwakabobik/testrail_api_reporter
flags: unittests
name: codecov-umbrella
fail_ci_if_error: true
- name: Coveralls GitHub Action
uses: coverallsapp/github-action@v2.2.3
with:
github-token: ${{ secrets.COVERALLS_REPO_TOKEN }}
39 changes: 39 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Tests-PR
on:
push:
branches-ignore:
- 'master'
pull_request:
branches-ignore:
- 'master'
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest
pip install pytest-xdist
pip install pytest-cov
pip install faker
pip install pillow
- name: Add 'testrail_api_reporter' to PYTHONPATH
run: echo "PYTHONPATH=$PYTHONPATH:$(pwd)/testrail_api_reporter:." >> $GITHUB_ENV
- name: Execute tests
id: tests
env:
FREEIMAGEHOST_API_KEY: ${{ secrets.FREEIMAGEHOST_API_KEY }}
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 .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
max-line-length=120

[MESSAGES CONTROL]
disable=E1101,R0913,W0718
disable=E1101,R0913,W0718,R0801

[DESIGN]
max-attributes=10
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Contributing to Transcriptase
# Contributing to Testrail API Reporter
We love your input! We want to make contributing to this project as easy and transparent as possible, whether it's:

- Reporting a bug
Expand Down Expand Up @@ -34,7 +34,7 @@ We use GitHub issues to track public bugs. Report a bug by [opening a new issue]
- A quick summary and/or background
- Steps to reproduce
- Be specific!
- Give sample code if you can. [My stackoverflow question](http://stackoverflow.com/q/12488905/180626) includes sample code that *anyone* with a base R setup can run to reproduce what I was seeing
- Give sample code if you can. [Stackoverflow question](http://stackoverflow.com/q/12488905/180626) includes sample code that *anyone* with a base R setup can run to reproduce what I was seeing
- What you expected would happen
- What actually happens
- Notes (possibly including why you think this might be happening, or stuff you tried that didn't work)
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 Ilya Vereshchagin
Copyright (c) 2024 Ilya Vereshchagin

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
# TestRail reporter

pypi package can be found [here](https://pypi.org/project/testrail-api-reporter/).
[![PyPI version](https://badge.fury.io/py/testrail-api-reporter.svg)](https://badge.fury.io/py/testrail-api-reporter)
[![Linters](https://github.com/wwakabobik/testrail-api-reporter/actions/workflows/master_linters.yml/badge.svg?branch=master)](https://github.com/wwakabobik/testrail-api-reporter/actions/workflows/master_linters.yml)
[![Tests](https://github.com/wwakabobik/testrail-api-reporter/actions/workflows/master_tests.yml/badge.svg?branch=master)](https://github.com/wwakabobik/testrail-api-reporter/actions/workflows/master_tests.yml)
[![Coverage Status](https://coveralls.io/repos/github/wwakabobik/testrail-api-reporter/badge.svg?branch=master)](https://coveralls.io/github/wwakabobik/testrail-api-reporter?branch=master)
[![codecov](https://codecov.io/gh/wwakabobik/testrail-api-reporter/graph/badge.svg?token=F1I7TBGE5U)](https://codecov.io/gh/wwakabobik/testrail-api-reporter)
![PyPI - License](https://img.shields.io/pypi/l/testrail-api-reporter)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/testrail-api-reporter)
[![Downloads](https://static.pepy.tech/badge/testrail_api_reporter)](https://pepy.tech/project/testrail_api_reporter)
[![Downloads](https://static.pepy.tech/badge/testrail_api_reporter/month)](https://pepy.tech/project/testrail_api_reporter)

## This is Testrail API reporter tools.

Expand Down
2 changes: 2 additions & 0 deletions __init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# -*- coding: utf-8 -*-
""" This module is used to import all the classes and functions from the package """

# Engines
from .testrail_api_reporter.engines.at_coverage_reporter import ATCoverageReporter
from .testrail_api_reporter.engines.results_reporter import TestRailResultsReporter
Expand Down
15 changes: 0 additions & 15 deletions __main__.py

This file was deleted.

5 changes: 5 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[pytest]
log_level=DEBUG
addopts = -vvv -rsfEx --tb=short -p no:warnings -p no:logging
norecursedirs = tests/test_source
python_paths = src
18 changes: 9 additions & 9 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
requests
xmltodict
testrail-api
plotly
psutil
atlassian-python-api==3.41.14
kaleido
httplib2
atlassian-python-api>=3.41.11
google-api-python-client
google-auth-httplib2
google-auth-oauthlib
google-api-python-client
httplib2
kaleido
oauth2client
plotly
psutil
requests
testrail-api
xmltodict
4 changes: 4 additions & 0 deletions testrail_api_reporter/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# -*- coding: utf-8 -*-
""" testrail_api_reporter package """

# Engines
from .engines.at_coverage_reporter import ATCoverageReporter
from .engines.plotly_reporter import PlotlyReporter
Expand All @@ -8,6 +10,8 @@
from .publishers.confluence_sender import ConfluenceSender
from .publishers.email_sender import EmailSender
from .publishers.slack_sender import SlackSender
from .publishers.gdrive_uploader import GoogleDriveUploader

# Utils
from .utils.reporter_utils import upload_image, delete_file, zip_file
from .utils.logger_config import setup_logger
4 changes: 3 additions & 1 deletion testrail_api_reporter/engines/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
""" Engines package """
# -*- coding: utf-8 -*-
""" Engines for testrail_api_reporter package """

from .at_coverage_reporter import ATCoverageReporter
from .case_backup import TCBackup
from .plotly_reporter import PlotlyReporter
Expand Down
Loading

0 comments on commit cc1cc44

Please sign in to comment.