Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .coverage
Binary file not shown.
36 changes: 9 additions & 27 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,28 +1,10 @@
# .coveragerc to control coverage.py
# .coveragerc
[run]
branch = True
source = src
# omit = bad_file.py

[paths]
source =
src/
*/site-packages/

[report]
# Regexes for lines to exclude from consideration
exclude_lines =
# Have to re-enable the standard pragma
pragma: no cover

# Don't complain about missing debug-only code:
def __repr__
if self\.debug

# Don't complain if tests don't hit defensive assertion code:
raise AssertionError
raise NotImplementedError

# Don't complain if non-runnable code isn't run:
if 0:
if __name__ == .__main__.:
relative_files = True
omit =
*/__init__.py
*__init__.py
*.py_
tests/*
*/app.py
*/venv/*
51 changes: 30 additions & 21 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,37 @@
name: CI

# Controls when the action will run.
name: Build
on:
push:
branches: [ main ]
branches:
- main
pull_request:
branches: [ main ]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
types: [opened, synchronize, reopened]
jobs:
job1:
name: Pruebas
sonarcloud:
environment: prod
name: SonarCloud
runs-on: ubuntu-latest
steps:
- name: Checkout de repositorio
uses: actions/checkout@v2
- name: Configuración de entorno de python
uses: actions/setup-python@v2
with:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.7'
- name: Instalación de librerías y dependencias
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Correr pruebas
id: correr-pruebas
run: python -m unittest discover -s tests
- name: Instalación de librerías y dependencias
run: pip install -r requirements.txt
- name: Correr pruebas
run: |
python -m coverage run -m unittest discover -s tests -v
python -m coverage xml
- name: Run SonarCloud Scan for ServicioFacturacion
uses: SonarSource/sonarcloud-github-action@v2
with:
args: >
-Dsonar.organization=langelb-1
-Dsonar.projectKey=langelb_TutorialCancionesTags
-Dsonar.projectBaseDir=.
-Dsonar.sources=.
-Dsonar.python.coverage.reportPaths=coverage.xml
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
86 changes: 0 additions & 86 deletions Jenkinsfile

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# test
# test
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
coverage==5.4
coverage
Faker==5.8.0
PyQt5==5.15.2
PyQt5
SQLAlchemy==1.3.22
19 changes: 19 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
sonar.projectKey=langelb_TutorialCancionesTags
sonar.organization=langelb-1
sonar.projectName=TutorialCancionesTags

sonar.projectBaseDir=.
sonar.sources=.
sonar.python.coverage.reportPaths=coverage.xml
sonar.exclusions=**/tests/**,**/__init__.py,**/app.py,**/users/**

# This is the name and version displayed in the SonarCloud UI.
#sonar.projectName=TutorialCancionesTags
#sonar.projectVersion=1.0


# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
#sonar.sources=.

# Encoding of the source code. Default is default system encoding
#sonar.sourceEncoding=UTF-8
8 changes: 8 additions & 0 deletions src/logica/coleccion.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,14 @@ def buscar_canciones_por_interprete(self, interprete_nombre):
Cancion.interpretes.any(Interprete.nombre.ilike('%{0}%'.format(interprete_nombre)))).all()
return canciones

def buscar_canciones_por_interpretes(self, interprete_nombre):
if interprete_nombre == "":
canciones = session.query(Cancion).all()
else:
canciones = session.query(Cancion).filter(
Cancion.interpretes.any(Interprete.nombre.ilike('%{0}%'.format(interprete_nombre)))).all()
return canciones

def asociar_cancion(self, cancion_id, album_id):
cancion = session.query(Cancion).filter(Cancion.id == cancion_id).first()
album = session.query(Album).filter(Album.id == album_id).first()
Expand Down