From e2d3a85cd2510751ff4138c769f1b94edb14b8fb Mon Sep 17 00:00:00 2001 From: Rawston Marinho Pinto <62628200+Rawston@users.noreply.github.com> Date: Wed, 15 Dec 2021 00:49:46 -0300 Subject: [PATCH 01/20] removendo link --- .idea/.gitignore | 3 ++ .idea/inspectionProfiles/Project_Default.xml | 37 +++++++++++++++++++ .../inspectionProfiles/profiles_settings.xml | 6 +++ .idea/libpythonpro.iml | 15 ++++++++ .idea/misc.xml | 4 ++ .idea/modules.xml | 8 ++++ .idea/vcs.xml | 6 +++ README.md | 4 -- requirements-dev.txt | 9 +++++ requirements.txt | 5 +++ 10 files changed, 93 insertions(+), 4 deletions(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/inspectionProfiles/Project_Default.xml create mode 100644 .idea/inspectionProfiles/profiles_settings.xml create mode 100644 .idea/libpythonpro.iml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 100644 requirements-dev.txt create mode 100644 requirements.txt diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 000000000..26d33521a --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 000000000..fc5fc7c73 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,37 @@ + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 000000000..105ce2da2 --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/libpythonpro.iml b/.idea/libpythonpro.iml new file mode 100644 index 000000000..5fdd65ba2 --- /dev/null +++ b/.idea/libpythonpro.iml @@ -0,0 +1,15 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 000000000..2478075b0 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 000000000..3478ad2cf --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 000000000..94a25f7f4 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/README.md b/README.md index 676c14d7f..2a4bf79d1 100644 --- a/README.md +++ b/README.md @@ -6,10 +6,6 @@ Nesse curso é ensinado como contribuir com projetos de código aberto Link para o curso [Python Pro](https://www.python.pro.br/) -[![Build Status](https://travis-ci.org/pythonprobr/libpythonpro.svg?branch=master)](https://travis-ci.org/pythonprobr/libpythonpro) -[![Updates](https://pyup.io/repos/github/pythonprobr/libpythonpro/shield.svg)](https://pyup.io/repos/github/pythonprobr/libpythonpro/) -[![Python 3](https://pyup.io/repos/github/pythonprobr/libpythonpro/python-3-shield.svg)](https://pyup.io/repos/github/pythonprobr/libpythonpro/) -[![codecov](https://codecov.io/gh/pythonprobr/libpythonpro/branch/master/graph/badge.svg)](https://codecov.io/gh/pythonprobr/libpythonpro) Suportada versão 3 de Python diff --git a/requirements-dev.txt b/requirements-dev.txt new file mode 100644 index 000000000..a4d408e7e --- /dev/null +++ b/requirements-dev.txt @@ -0,0 +1,9 @@ +certifi==2021.10.8 +charset-normalizer==2.0.9 +flake8==4.0.1 +idna==3.3 +mccabe==0.6.1 +pycodestyle==2.8.0 +pyflakes==2.4.0 +requests==2.26.0 +urllib3==1.26.7 diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 000000000..a913432e6 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,5 @@ +certifi==2021.10.8 +charset-normalizer==2.0.9 +idna==3.3 +requests==2.26.0 +urllib3==1.26.7 From 6f8e7efdae23ccd061457632391817c19f58f574 Mon Sep 17 00:00:00 2001 From: Rawston Marinho Pinto <62628200+Rawston@users.noreply.github.com> Date: Wed, 15 Dec 2021 00:57:06 -0300 Subject: [PATCH 02/20] inserindo link no close #4 --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 2a4bf79d1..3d97146b5 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,6 @@ Nesse curso é ensinado como contribuir com projetos de código aberto Link para o curso [Python Pro](https://www.python.pro.br/) - Suportada versão 3 de Python Para instalar: From 99c25374faea70e54e4a72d93484116b62443daf Mon Sep 17 00:00:00 2001 From: Rawston Marinho Pinto <62628200+Rawston@users.noreply.github.com> Date: Wed, 15 Dec 2021 02:05:48 -0300 Subject: [PATCH 03/20] inserindo link no close #4 --- .idea/libpythonpro.iml | 6 ++++-- .idea/misc.xml | 2 +- libpythonpro/github_api.py | 2 ++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.idea/libpythonpro.iml b/.idea/libpythonpro.iml index 5fdd65ba2..ceaaabe36 100644 --- a/.idea/libpythonpro.iml +++ b/.idea/libpythonpro.iml @@ -1,8 +1,10 @@ - - + + + + diff --git a/.idea/misc.xml b/.idea/misc.xml index 2478075b0..66f48d7fc 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,4 +1,4 @@ - + \ No newline at end of file diff --git a/libpythonpro/github_api.py b/libpythonpro/github_api.py index 8b0fbafb9..e39a6b2d6 100644 --- a/libpythonpro/github_api.py +++ b/libpythonpro/github_api.py @@ -11,3 +11,5 @@ def buscar_avatar(usuario): url = f'https://api.github.com/users/{usuario}' resp = requests.get(url) return resp.json()['avatar_url'] +if __name__ == '__main__': + print(buscar_avatar('Rawston')) From fa334fd48cbbf993ebace5eefe744398f24b6794 Mon Sep 17 00:00:00 2001 From: Rawston Marinho Pinto <62628200+Rawston@users.noreply.github.com> Date: Wed, 15 Dec 2021 02:07:09 -0300 Subject: [PATCH 04/20] git --- libpythonpro/github_api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libpythonpro/github_api.py b/libpythonpro/github_api.py index e39a6b2d6..fa3dab1d1 100644 --- a/libpythonpro/github_api.py +++ b/libpythonpro/github_api.py @@ -12,4 +12,4 @@ def buscar_avatar(usuario): resp = requests.get(url) return resp.json()['avatar_url'] if __name__ == '__main__': - print(buscar_avatar('Rawston')) + print(buscar_avatar('Rawston')0 From 34a41049b2d7e3d74cc5a28a059500c51df8f613 Mon Sep 17 00:00:00 2001 From: Rawston Marinho Pinto <62628200+Rawston@users.noreply.github.com> Date: Wed, 15 Dec 2021 02:07:26 -0300 Subject: [PATCH 05/20] git --- libpythonpro/github_api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libpythonpro/github_api.py b/libpythonpro/github_api.py index fa3dab1d1..6a90b3ce6 100644 --- a/libpythonpro/github_api.py +++ b/libpythonpro/github_api.py @@ -12,4 +12,4 @@ def buscar_avatar(usuario): resp = requests.get(url) return resp.json()['avatar_url'] if __name__ == '__main__': - print(buscar_avatar('Rawston')0 + print(buscar_avatar('Rawston') From 881452863bce333112deeeaf0e1d0d0445816a4f Mon Sep 17 00:00:00 2001 From: Rawston Marinho Pinto <62628200+Rawston@users.noreply.github.com> Date: Thu, 16 Dec 2021 00:27:07 -0300 Subject: [PATCH 06/20] =?UTF-8?q?adicionada=20flake8=20como=20depend=C3=AA?= =?UTF-8?q?ncia?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit close #12 --- README.md | 3 +++ libpythonpro/github_api.py | 4 +++- requirements-dev.txt | 6 +----- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 3d97146b5..3efb073e8 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,9 @@ Suportada versão 3 de Python Para instalar: ```console +python3 -m venv .venv +.venv\Sctripts\activate +pip install -r reqirements-dev.txt pip install pipenv pipenv install --dev ``` diff --git a/libpythonpro/github_api.py b/libpythonpro/github_api.py index 6a90b3ce6..75df1d64c 100644 --- a/libpythonpro/github_api.py +++ b/libpythonpro/github_api.py @@ -11,5 +11,7 @@ def buscar_avatar(usuario): url = f'https://api.github.com/users/{usuario}' resp = requests.get(url) return resp.json()['avatar_url'] + + if __name__ == '__main__': - print(buscar_avatar('Rawston') + print(buscar_avatar('Rawston')) diff --git a/requirements-dev.txt b/requirements-dev.txt index a4d408e7e..a116acd08 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,9 +1,5 @@ -certifi==2021.10.8 -charset-normalizer==2.0.9 flake8==4.0.1 -idna==3.3 mccabe==0.6.1 pycodestyle==2.8.0 pyflakes==2.4.0 -requests==2.26.0 -urllib3==1.26.7 +-r requirements.txt From cb90996c265295d8943f52f05eaabd6a01a7da0d Mon Sep 17 00:00:00 2001 From: Rawston Marinho Pinto <62628200+Rawston@users.noreply.github.com> Date: Thu, 16 Dec 2021 00:45:30 -0300 Subject: [PATCH 07/20] Configurado Tavis CI close #13 --- .travis.yml | 3 +++ README.md | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 6694375b7..e804ccf50 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,10 @@ language: python python: - 3.7 + - 3.10.0 + - 3.10.1 install: + - pip install -r requirements-dev.txt - pip install -q pipenv codecov - pipenv sync --dev script: diff --git a/README.md b/README.md index 3efb073e8..00b29ecc6 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ # libpythonpro - Módulo para exemplificar construção de projetos Python no curso PyTools Nesse curso é ensinado como contribuir com projetos de código aberto Link para o curso [Python Pro](https://www.python.pro.br/) +[![Build Status](https://app.travis-ci.com/Rawston/libpythonpro.svg?branch=master)](https://app.travis-ci.com/Rawston/libpythonpro) Suportada versão 3 de Python Para instalar: From 24762cd274f6664919c0de0f33649047190ae811 Mon Sep 17 00:00:00 2001 From: Rawston Marinho Pinto <62628200+Rawston@users.noreply.github.com> Date: Thu, 16 Dec 2021 01:09:43 -0300 Subject: [PATCH 08/20] =?UTF-8?q?Removendo=20detalhes=20de=20depend=C3=AAn?= =?UTF-8?q?cia=20durante=20o=20build?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit close #13 --- .travis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index e804ccf50..75d0cf825 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,8 +4,7 @@ python: - 3.10.0 - 3.10.1 install: - - pip install -r requirements-dev.txt - - pip install -q pipenv codecov + - pip install -q -r pipenv codecov - pipenv sync --dev script: - flake8 From dbb73dbf09242f81f354e1cbb3b1c579d433fb65 Mon Sep 17 00:00:00 2001 From: pyup-bot Date: Fri, 17 Dec 2021 01:36:09 -0300 Subject: [PATCH 09/20] Update importlib-metadata from 0.18 to 4.9.0 --- Pipfile.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Pipfile.lock b/Pipfile.lock index 8a647ca6f..e3b1bdd4d 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -122,10 +122,10 @@ }, "importlib-metadata": { "hashes": [ - "sha256:6dfd58dfe281e8d240937776065dd3624ad5469c835248219bd16cf2e12dbeb7", - "sha256:cb6ee23b46173539939964df59d3d72c3e0c1b5d54b84f1d8a7e912fe43612db" + "sha256:e8b45564028bc25f8c99f546616112a6df5de6655893d7eb74c9a99680dc9751", + "sha256:ee50794eccb0ec340adbc838344ebb9a6ff2bcba78f752d31fc716497e2149d6" ], - "version": "==0.18" + "version": "==4.9.0" }, "mccabe": { "hashes": [ From 73ab0277a00bd2d1444b3b93b2cfe937c0aa9487 Mon Sep 17 00:00:00 2001 From: Rawston Marinho Pinto <62628200+Rawston@users.noreply.github.com> Date: Fri, 17 Dec 2021 01:44:46 -0300 Subject: [PATCH 10/20] Integrado com PyUp --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 00b29ecc6..615b85293 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,8 @@ Nesse curso é ensinado como contribuir com projetos de código aberto Link para o curso [Python Pro](https://www.python.pro.br/) [![Build Status](https://app.travis-ci.com/Rawston/libpythonpro.svg?branch=master)](https://app.travis-ci.com/Rawston/libpythonpro) +[![Updates](https://pyup.io/repos/github/Rawston/libpythonpro/shield.svg)](https://pyup.io/repos/github/Rawston/libpythonpro/) +[![Python 3](https://pyup.io/repos/github/Rawston/libpythonpro/python-3-shield.svg)](https://pyup.io/repos/github/Rawston/libpythonpro/) Suportada versão 3 de Python Para instalar: From d3687a414935f5beb1e31bfe08dd60b4605a766e Mon Sep 17 00:00:00 2001 From: Rawston Marinho Pinto <62628200+Rawston@users.noreply.github.com> Date: Sat, 18 Dec 2021 21:00:27 -0300 Subject: [PATCH 11/20] Instalando local de pacote --- libpythonpro/spam/__init__.py | 0 libpythonpro/spam/db.py | 31 ------------ libpythonpro/spam/enviador_de_email.py | 9 ---- libpythonpro/spam/main.py | 13 ----- libpythonpro/spam/modelos.py | 5 -- libpythonpro/tests/__init__.py | 0 libpythonpro/tests/test_exemplo.py | 2 - libpythonpro/tests/test_spam/__init__.py | 0 libpythonpro/tests/test_spam/conftest.py | 20 -------- .../tests/test_spam/test_enviador_de_email.py | 38 -------------- .../test_envio_para_base_de_usuarios.py | 49 ------------------- .../tests/test_spam/test_github_api.py | 28 ----------- libpythonpro/tests/test_spam/test_usuarios.py | 17 ------- setup.py | 8 +-- 14 files changed, 4 insertions(+), 216 deletions(-) delete mode 100644 libpythonpro/spam/__init__.py delete mode 100644 libpythonpro/spam/db.py delete mode 100644 libpythonpro/spam/enviador_de_email.py delete mode 100644 libpythonpro/spam/main.py delete mode 100644 libpythonpro/spam/modelos.py delete mode 100644 libpythonpro/tests/__init__.py delete mode 100644 libpythonpro/tests/test_exemplo.py delete mode 100644 libpythonpro/tests/test_spam/__init__.py delete mode 100644 libpythonpro/tests/test_spam/conftest.py delete mode 100644 libpythonpro/tests/test_spam/test_enviador_de_email.py delete mode 100644 libpythonpro/tests/test_spam/test_envio_para_base_de_usuarios.py delete mode 100644 libpythonpro/tests/test_spam/test_github_api.py delete mode 100644 libpythonpro/tests/test_spam/test_usuarios.py diff --git a/libpythonpro/spam/__init__.py b/libpythonpro/spam/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/libpythonpro/spam/db.py b/libpythonpro/spam/db.py deleted file mode 100644 index ce90ca60b..000000000 --- a/libpythonpro/spam/db.py +++ /dev/null @@ -1,31 +0,0 @@ -from time import sleep - - -class Sessao: - contador = 0 - usuarios = [] - - def salvar(self, usuario): - Sessao.contador += 1 - usuario.id = Sessao.contador - self.usuarios.append(usuario) - - def listar(self): - return self.usuarios - - def roll_back(self): - self.usuarios.clear() - - def fechar(self): - pass - - -class Conexao: - def __init__(self): - sleep(1) - - def gerar_sessao(self): - return Sessao() - - def fechar(self): - pass diff --git a/libpythonpro/spam/enviador_de_email.py b/libpythonpro/spam/enviador_de_email.py deleted file mode 100644 index fa0952223..000000000 --- a/libpythonpro/spam/enviador_de_email.py +++ /dev/null @@ -1,9 +0,0 @@ -class Enviador: - def enviar(self, remetente, destinatario, assunto, corpo): - if '@' not in remetente: - raise EmailInvalido(f'Email de remetente inválido: {remetente}') - return remetente - - -class EmailInvalido(Exception): - pass diff --git a/libpythonpro/spam/main.py b/libpythonpro/spam/main.py deleted file mode 100644 index f81821ae4..000000000 --- a/libpythonpro/spam/main.py +++ /dev/null @@ -1,13 +0,0 @@ -class EnviadorDeSpam: - def __init__(self, sessao, enviador): - self.sessao = sessao - self.enviador = enviador - - def enviar_emails(self, remetente, assunto, corpo): - for usuario in self.sessao.listar(): - self.enviador.enviar( - remetente, - usuario.email, - assunto, - corpo - ) diff --git a/libpythonpro/spam/modelos.py b/libpythonpro/spam/modelos.py deleted file mode 100644 index 093b35a2a..000000000 --- a/libpythonpro/spam/modelos.py +++ /dev/null @@ -1,5 +0,0 @@ -class Usuario: - def __init__(self, nome, email): - self.email = email - self.nome = nome - self.id = None diff --git a/libpythonpro/tests/__init__.py b/libpythonpro/tests/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/libpythonpro/tests/test_exemplo.py b/libpythonpro/tests/test_exemplo.py deleted file mode 100644 index 78cd50236..000000000 --- a/libpythonpro/tests/test_exemplo.py +++ /dev/null @@ -1,2 +0,0 @@ -def test_int(): - assert 1 == 1 diff --git a/libpythonpro/tests/test_spam/__init__.py b/libpythonpro/tests/test_spam/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/libpythonpro/tests/test_spam/conftest.py b/libpythonpro/tests/test_spam/conftest.py deleted file mode 100644 index a16f3970a..000000000 --- a/libpythonpro/tests/test_spam/conftest.py +++ /dev/null @@ -1,20 +0,0 @@ -import pytest - -from libpythonpro.spam.db import Conexao - - -@pytest.fixture(scope='session') -def conexao(): - # Setup - conexao_obj = Conexao() - yield conexao_obj - # Tear Down - conexao_obj.fechar() - - -@pytest.fixture -def sessao(conexao): - sessao_obj = conexao.gerar_sessao() - yield sessao_obj - sessao_obj.roll_back() - sessao_obj.fechar() diff --git a/libpythonpro/tests/test_spam/test_enviador_de_email.py b/libpythonpro/tests/test_spam/test_enviador_de_email.py deleted file mode 100644 index c72a0bbe9..000000000 --- a/libpythonpro/tests/test_spam/test_enviador_de_email.py +++ /dev/null @@ -1,38 +0,0 @@ -import pytest - -from libpythonpro.spam.enviador_de_email import EmailInvalido, Enviador - - -def test_criar_enviador_de_email(): - enviador = Enviador() - assert enviador is not None - - -@pytest.mark.parametrize( - 'remetente', - ['foo@bar.com.br', 'renzo@python.pro.br'] -) -def test_remetente(remetente): - enviador = Enviador() - resultado = enviador.enviar( - remetente, - 'luciano@python.pro.br', - 'Cursos Python Pro', - 'Primeira turma Guido Von Rossum aberta.' - ) - assert remetente in resultado - - -@pytest.mark.parametrize( - 'remetente', - ['', 'renzo'] -) -def test_remetente_invalido(remetente): - enviador = Enviador() - with pytest.raises(EmailInvalido): - enviador.enviar( - remetente, - 'luciano@python.pro.br', - 'Cursos Python Pro', - 'Primeira turma Guido Von Rossum aberta.' - ) diff --git a/libpythonpro/tests/test_spam/test_envio_para_base_de_usuarios.py b/libpythonpro/tests/test_spam/test_envio_para_base_de_usuarios.py deleted file mode 100644 index d2db43893..000000000 --- a/libpythonpro/tests/test_spam/test_envio_para_base_de_usuarios.py +++ /dev/null @@ -1,49 +0,0 @@ -from unittest.mock import Mock - -import pytest - -from libpythonpro.spam.main import EnviadorDeSpam -from libpythonpro.spam.modelos import Usuario - - -@pytest.mark.parametrize( - 'usuarios', - [ - [ - Usuario(nome='Renzo', email='renzo@python.pro.br'), - Usuario(nome='Luciano', email='renzo@python.pro.br') - ], - [ - Usuario(nome='Renzo', email='renzo@python.pro.br') - ] - ] -) -def test_qde_de_spam(sessao, usuarios): - for usuario in usuarios: - sessao.salvar(usuario) - enviador = Mock() - enviador_de_spam = EnviadorDeSpam(sessao, enviador) - enviador_de_spam.enviar_emails( - 'renzo@python.pro.br', - 'Curso Python Pro', - 'Confira os módulos fantásticos' - ) - assert len(usuarios) == enviador.enviar.call_count - - -def test_parametros_de_spam(sessao): - usuario = Usuario(nome='Renzo', email='renzo@python.pro.br') - sessao.salvar(usuario) - enviador = Mock() - enviador_de_spam = EnviadorDeSpam(sessao, enviador) - enviador_de_spam.enviar_emails( - 'luciano@python.pro.br', - 'Curso Python Pro', - 'Confira os módulos fantásticos' - ) - enviador.enviar.assert_called_once_with( - 'luciano@python.pro.br', - 'renzo@python.pro.br', - 'Curso Python Pro', - 'Confira os módulos fantásticos' - ) diff --git a/libpythonpro/tests/test_spam/test_github_api.py b/libpythonpro/tests/test_spam/test_github_api.py deleted file mode 100644 index 21ce9c5d0..000000000 --- a/libpythonpro/tests/test_spam/test_github_api.py +++ /dev/null @@ -1,28 +0,0 @@ -from unittest.mock import Mock - -import pytest - -from libpythonpro import github_api - - -@pytest.fixture -def avatar_url(mocker): - resp_mock = Mock() - url = 'https://avatars3.githubusercontent.com/u/402714?v=4' - resp_mock.json.return_value = { - 'login': 'renzo', 'id': 402714, - 'avatar_url': url, - } - get_mock = mocker.patch('libpythonpro.github_api.requests.get') - get_mock.return_value = resp_mock - return url - - -def test_buscar_avatar(avatar_url): - url = github_api.buscar_avatar('renzo') - assert avatar_url == url - - -def test_buscar_avatar_integracao(): - url = github_api.buscar_avatar('renzon') - assert 'https://avatars3.githubusercontent.com/u/3457115?v=4' == url diff --git a/libpythonpro/tests/test_spam/test_usuarios.py b/libpythonpro/tests/test_spam/test_usuarios.py deleted file mode 100644 index 09b523445..000000000 --- a/libpythonpro/tests/test_spam/test_usuarios.py +++ /dev/null @@ -1,17 +0,0 @@ -from libpythonpro.spam.modelos import Usuario - - -def test_salvar_usuario(sessao): - usuario = Usuario(nome='Renzo', email='renzo@python.pro.br') - sessao.salvar(usuario) - assert isinstance(usuario.id, int) - - -def test_listar_usuarios(sessao): - usuarios = [ - Usuario(nome='Renzo', email='renzo@python.pro.br'), - Usuario(nome='Luciano', email='renzo@python.pro.br') - ] - for usuario in usuarios: - sessao.salvar(usuario) - assert usuarios == sessao.listar() diff --git a/setup.py b/setup.py index 1fea97a65..631d488f7 100644 --- a/setup.py +++ b/setup.py @@ -102,11 +102,11 @@ def find_package_data( PACKAGE = "libpythonpro" -NAME = PACKAGE +NAME = "Rawstonpact" DESCRIPTION = "Módulo para exemplificar construção de projetos Python no curso PyTools" -AUTHOR = "Renzo Nuccitelli" -AUTHOR_EMAIL = "renzo@python.pro.br" -URL = "https://github.com/pythonprobr/libpythonpro" +AUTHOR = "Rawston Marinho" +AUTHOR_EMAIL = "houston_cam@msn.com" +URL = "https://github.com/Rawston/libpythonpro" VERSION = __import__(PACKAGE).__version__ setup( From 255fb4a4ded784b834233ec6ed4e864d78cf47b9 Mon Sep 17 00:00:00 2001 From: Rawston Marinho Pinto <62628200+Rawston@users.noreply.github.com> Date: Sun, 19 Dec 2021 01:16:19 -0300 Subject: [PATCH 12/20] Inserido teste com pytest close #21 --- libpythonpro/tests/__init__.py | 0 libpythonpro/tests/test_exemplo.py | 2 ++ requirements-dev.txt | 8 ++++++++ 3 files changed, 10 insertions(+) create mode 100644 libpythonpro/tests/__init__.py create mode 100644 libpythonpro/tests/test_exemplo.py diff --git a/libpythonpro/tests/__init__.py b/libpythonpro/tests/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/libpythonpro/tests/test_exemplo.py b/libpythonpro/tests/test_exemplo.py new file mode 100644 index 000000000..c6f49de88 --- /dev/null +++ b/libpythonpro/tests/test_exemplo.py @@ -0,0 +1,2 @@ +def test_int(): + assert 1 == 0 \ No newline at end of file diff --git a/requirements-dev.txt b/requirements-dev.txt index a116acd08..586676d5e 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -2,4 +2,12 @@ flake8==4.0.1 mccabe==0.6.1 pycodestyle==2.8.0 pyflakes==2.4.0 + +# Deps do pytest +py==1.8.2 +atomicwrites==1.0 +pluggy<2.0,==0.12 +attrs==19.2.0 +pyparsing!=3.0.5,==2.0.2 +pytest==6.2.5 -r requirements.txt From 43aa5b21e918e753198db8dce2a8376a2fd627e5 Mon Sep 17 00:00:00 2001 From: Rawston Marinho Pinto <62628200+Rawston@users.noreply.github.com> Date: Sun, 19 Dec 2021 02:05:17 -0300 Subject: [PATCH 13/20] Create main.yml --- .github/workflows/main.yml | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 000000000..50f6df57e --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,38 @@ +name: Python application + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.9 + uses: actions/setup-python@v2 + with: + python-version: 3.9 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install codecov + pip install flake8 pytest + pip install -r requirements-dev.txt + - name: Lint with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Teste de código com pytest + run: | + pytest --cov=LibPythonPro + - name: Cobertura de testes com codecov + uses: codecov/codecov-action@v1 + with: + token: ${{secrets.CODECOV_TOKEN}} From 970658200509a38028bdbf85cf6ceef6aaf62d24 Mon Sep 17 00:00:00 2001 From: Rawston Marinho Pinto <62628200+Rawston@users.noreply.github.com> Date: Sun, 19 Dec 2021 02:14:52 -0300 Subject: [PATCH 14/20] Inserido teste com pytest close #21 --- libpythonpro/tests/test_exemplo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libpythonpro/tests/test_exemplo.py b/libpythonpro/tests/test_exemplo.py index c6f49de88..775ac58e1 100644 --- a/libpythonpro/tests/test_exemplo.py +++ b/libpythonpro/tests/test_exemplo.py @@ -1,2 +1,2 @@ def test_int(): - assert 1 == 0 \ No newline at end of file + assert 1 == 1 \ No newline at end of file From 26e7ceb355b07f306140807e71268871c98e2ff0 Mon Sep 17 00:00:00 2001 From: Rawston Marinho Pinto <62628200+Rawston@users.noreply.github.com> Date: Sun, 19 Dec 2021 02:15:41 -0300 Subject: [PATCH 15/20] Inserido teste com pytest close #21 --- libpythonpro/tests/test_exemplo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libpythonpro/tests/test_exemplo.py b/libpythonpro/tests/test_exemplo.py index 775ac58e1..c6f49de88 100644 --- a/libpythonpro/tests/test_exemplo.py +++ b/libpythonpro/tests/test_exemplo.py @@ -1,2 +1,2 @@ def test_int(): - assert 1 == 1 \ No newline at end of file + assert 1 == 0 \ No newline at end of file From 41795d6026ea2c130b9fb751e6bdb583d00de409 Mon Sep 17 00:00:00 2001 From: Rawston Marinho Pinto <62628200+Rawston@users.noreply.github.com> Date: Sun, 19 Dec 2021 02:15:41 -0300 Subject: [PATCH 16/20] Inserido teste com pytest close #21 --- libpythonpro/tests/test_exemplo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libpythonpro/tests/test_exemplo.py b/libpythonpro/tests/test_exemplo.py index 775ac58e1..c6f49de88 100644 --- a/libpythonpro/tests/test_exemplo.py +++ b/libpythonpro/tests/test_exemplo.py @@ -1,2 +1,2 @@ def test_int(): - assert 1 == 1 \ No newline at end of file + assert 1 == 0 \ No newline at end of file From e61ac5eaa544210cb661eb50fbfbba2c1b697b86 Mon Sep 17 00:00:00 2001 From: Rawston Marinho Pinto <62628200+Rawston@users.noreply.github.com> Date: Thu, 23 Dec 2021 00:48:33 -0300 Subject: [PATCH 17/20] Create codecov.md --- codecov.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 codecov.md diff --git a/codecov.md b/codecov.md new file mode 100644 index 000000000..3c375cf10 --- /dev/null +++ b/codecov.md @@ -0,0 +1,13 @@ +language: python +python: + - 3.7 + - 3.10.0 + - 3.10.1 +install: + - pip install -q -r pipenv codecov + - pipenv sync --dev +script: + - flake8 + - pytest libpythonpro --cov=libpythonpro +after_success: + - codecov From d8f62c57b4213d429dcd0ade596c5c5d98f01089 Mon Sep 17 00:00:00 2001 From: Rawston Marinho Pinto <62628200+Rawston@users.noreply.github.com> Date: Thu, 23 Dec 2021 00:51:08 -0300 Subject: [PATCH 18/20] codecov.yml --- codecov.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 codecov.yml diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 000000000..75d0cf825 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,13 @@ +language: python +python: + - 3.7 + - 3.10.0 + - 3.10.1 +install: + - pip install -q -r pipenv codecov + - pipenv sync --dev +script: + - flake8 + - pytest libpythonpro --cov=libpythonpro +after_success: + - codecov \ No newline at end of file From 62025fcc4ba611d372901cd816ac7f2dc4a44969 Mon Sep 17 00:00:00 2001 From: Rawston Marinho Pinto <62628200+Rawston@users.noreply.github.com> Date: Thu, 23 Dec 2021 01:20:32 -0300 Subject: [PATCH 19/20] =?UTF-8?q?Acrescentada=20cobertura=20de=20c=C3=B3di?= =?UTF-8?q?go?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit close #23 --- codecov.md | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 codecov.md diff --git a/codecov.md b/codecov.md deleted file mode 100644 index 3c375cf10..000000000 --- a/codecov.md +++ /dev/null @@ -1,13 +0,0 @@ -language: python -python: - - 3.7 - - 3.10.0 - - 3.10.1 -install: - - pip install -q -r pipenv codecov - - pipenv sync --dev -script: - - flake8 - - pytest libpythonpro --cov=libpythonpro -after_success: - - codecov From 142fbe17ed087c4cc87abd6a7faa52432388795e Mon Sep 17 00:00:00 2001 From: Rawston Date: Wed, 1 Feb 2023 11:23:13 -0300 Subject: [PATCH 20/20] Readme!! --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 615b85293..6ffa3fa7c 100644 --- a/README.md +++ b/README.md @@ -13,8 +13,9 @@ Suportada versão 3 de Python Para instalar: ```console -python3 -m venv .venv -.venv\Sctripts\activate +python3 -m venv env +{windows} - env\Sctripts\activate {windows} +{Ubuntu} - source env/bin/activate pip install -r reqirements-dev.txt pip install pipenv pipenv install --dev