Skip to content

Commit

Permalink
Merge pull request #209 from ResidenciaTICBrisa/testes
Browse files Browse the repository at this point in the history
(#185) Adição de testes unitários para todas as fontes de dados
  • Loading branch information
Victor-oss authored Nov 2, 2023
2 parents 2d70296 + c95c058 commit d818b27
Show file tree
Hide file tree
Showing 287 changed files with 11,819 additions and 1,277 deletions.
2 changes: 2 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[run]
omit = scripts/tests/*,scripts/epe_matriz.py,*/__init__.py,scripts/main.py,scripts/handlers/benHandler.py,scripts/handlers/pneHandler.py
5 changes: 3 additions & 2 deletions .github/workflows/atualiza_tabelas.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: run main.py

on:
schedule: [{cron: "0 19 * * 3"}] #agendamento
schedule: [{cron: "0 0 * * 5-6"}] #agendamento

jobs:
build:
Expand All @@ -19,8 +19,9 @@ jobs:
pip install pandas==2.0.2
pip install bs4==0.0.1
pip install openpyxl==3.1.2
pip install requests_html==0.10.0
- name: execute py script # run main.py
run: python 04_PipelineTCU/scripts/main.py
run: python scripts/main.py
- name: commit files
run: |
git config --local user.email "[email protected]"
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Python Linter

on:
push:
pull_request:
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8
pip install pylint
- name: Lint flake8
run: |
flake8 scripts --ignore=E203,W291,W293 --max-line-length=240 --show-source --statistics
find . -type f -name "*.py" -exec pylint --disable=C0103,C0301,C0114,W0703,W0622,R0913,E1101,R0903,R0915,R0912,W0612,E0401,R0914 -j 0 --exit-zero {} \;
29 changes: 29 additions & 0 deletions .github/workflows/testes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: teste-unitario-automatizado

on: # Quando o usuário realizar um push, será feito os testes
push:
pull_request:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: |
pip install --upgrade pip
pip install --upgrade pip
pip install requests==2.31.0
pip install pandas==2.0.2
pip install bs4==0.0.1
pip install openpyxl==3.1.2
pip install requests_html==0.10.0
- name: Test with pytest
run: | # Vai realizar os testes
pip install pytest
pip install pytest-cov
pytest --cov-config=.coveragerc --cov=scripts
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
env*
venv*
04_PipelineTCU/__pycache__
scripts/__pycache__
scripts/scrappers/__pycache__
scripts/handlers/__pycache__
scripts/tests/__pycache__
.coverage
.pytest_cache
Empty file added scripts/__init__.py
Empty file.
202 changes: 0 additions & 202 deletions scripts/anuarioHandler.py

This file was deleted.

87 changes: 0 additions & 87 deletions scripts/benHandler.py

This file was deleted.

Loading

0 comments on commit d818b27

Please sign in to comment.