diff --git a/.coverage b/.coverage new file mode 100644 index 00000000..cf2ed12b Binary files /dev/null and b/.coverage differ diff --git a/.coveragerc b/.coveragerc index fecdbb13..dc3052c0 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,7 +1,7 @@ -# .coveragerc to control coverage.py -[run] +[coverage:run] +relative_files = True branch = True -source = src +source = src/ # omit = bad_file.py [paths] @@ -9,7 +9,7 @@ source = src/ */site-packages/ -[report] +[coverage:report] # Regexes for lines to exclude from consideration exclude_lines = # Have to re-enable the standard pragma @@ -25,4 +25,4 @@ exclude_lines = # Don't complain if non-runnable code isn't run: if 0: - if __name__ == .__main__.: + if __name__ == .__main__.: \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..af0c7145 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,34 @@ +name: Build +on: + push: + branches: + - main + pull_request: + types: [opened, synchronize, reopened] + +jobs: + sonarcloud: + name: SonarCloud + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: 3.9 + - name: Instalación de librerías y dependencias + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + + - name: Run tox + run: | + tox -e py + + - name: SonarCloud Scan + uses: SonarSource/sonarcloud-github-action@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index bf66c587..00000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: CI - -# Controls when the action will run. -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - -# A workflow run is made up of one or more jobs that can run sequentially or in parallel -jobs: - job1: - name: Pruebas - 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: - 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 diff --git a/.gitignore b/.gitignore index 38d9605f..8b4966d6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .idea/* +env/* src/modelo/__pycache__/* src/logica/__pycache__/* src/vista/__pycache__/* diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..6401dbac --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,15 @@ +{ + "python.testing.unittestArgs": [ + "-v", + "-s", + "./tests", + "-p", + "test_*.py" + ], + "python.testing.pytestEnabled": false, + "python.testing.unittestEnabled": true, + "sonarlint.connectedMode.project": { + "connectionId": "jjmontenegrop", + "projectKey": "JJMontenegroP_TutorialCancionesTags" + } +} \ No newline at end of file diff --git a/aplicacion.sqlite b/aplicacion.sqlite new file mode 100644 index 00000000..1deb6e88 Binary files /dev/null and b/aplicacion.sqlite differ diff --git a/coverage.xml b/coverage.xml new file mode 100644 index 00000000..529fb1e7 --- /dev/null +++ b/coverage.xml @@ -0,0 +1,1453 @@ + + + + + + /home/juan/Documents/Uniandes/Metricas y Calidad de Software/TutorialCancionesTags + src/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 00000000..a5661875 --- /dev/null +++ b/pytest.ini @@ -0,0 +1,3 @@ +# pytest.ini +[pytest] +testpaths = tests \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 69d16165..77ea5e5b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,3 +2,4 @@ coverage==5.4 Faker==5.8.0 PyQt5==5.15.2 SQLAlchemy==1.3.22 +tox diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 00000000..fa61193e --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,19 @@ +sonar.projectKey=JJMontenegroP_TutorialCancionesTags +sonar.organization=jjmontenegrop + +sonar.sources=./ +sonar.python.coverage.reportPaths=coverage.xml +sonar.python.version=3.9 +sonar.inclusions=src/**/*.py +sonar.exclusions=tests/**/*.py + +# 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 + diff --git a/src/__main__.py b/src/__main__.py index f3d45f42..d133544f 100644 --- a/src/__main__.py +++ b/src/__main__.py @@ -11,4 +11,4 @@ coleccion = Coleccion() app = ic.App(sys.argv, coleccion) - sys.exit(app.exec_()) \ No newline at end of file + sys.exit(app.exec_()) diff --git a/src/modelo/album.py b/src/modelo/album.py index 7ec1b06a..60979922 100644 --- a/src/modelo/album.py +++ b/src/modelo/album.py @@ -16,8 +16,8 @@ class Album(Base): __tablename__ = 'album' id = Column(Integer, primary_key=True) - titulo = Column(String) - ano = Column(Integer) - descripcion = Column(String) - medio = Column(Enum(Medio)) + titulo = Column(String(500)) + descripcion = Column(String(2000)) + ano = Column(Integer, default=0) + medio = Column(Enum(Medio, native_enum=False)) canciones = relationship('Cancion', secondary='album_cancion') diff --git a/tests/__pycache__/test_album.cpython-312-pytest-8.3.3.pyc b/tests/__pycache__/test_album.cpython-312-pytest-8.3.3.pyc new file mode 100644 index 00000000..22ea24d2 Binary files /dev/null and b/tests/__pycache__/test_album.cpython-312-pytest-8.3.3.pyc differ diff --git a/tests/__pycache__/test_album.cpython-312.pyc b/tests/__pycache__/test_album.cpython-312.pyc new file mode 100644 index 00000000..381f9142 Binary files /dev/null and b/tests/__pycache__/test_album.cpython-312.pyc differ diff --git a/tests/__pycache__/test_cancion.cpython-312-pytest-8.3.3.pyc b/tests/__pycache__/test_cancion.cpython-312-pytest-8.3.3.pyc new file mode 100644 index 00000000..6dbb715a Binary files /dev/null and b/tests/__pycache__/test_cancion.cpython-312-pytest-8.3.3.pyc differ diff --git a/tests/__pycache__/test_cancion.cpython-312.pyc b/tests/__pycache__/test_cancion.cpython-312.pyc new file mode 100644 index 00000000..71a539a0 Binary files /dev/null and b/tests/__pycache__/test_cancion.cpython-312.pyc differ diff --git a/tests/__pycache__/test_interprete.cpython-312-pytest-8.3.3.pyc b/tests/__pycache__/test_interprete.cpython-312-pytest-8.3.3.pyc new file mode 100644 index 00000000..5bb630d6 Binary files /dev/null and b/tests/__pycache__/test_interprete.cpython-312-pytest-8.3.3.pyc differ diff --git a/tests/__pycache__/test_interprete.cpython-312.pyc b/tests/__pycache__/test_interprete.cpython-312.pyc new file mode 100644 index 00000000..8429bc2d Binary files /dev/null and b/tests/__pycache__/test_interprete.cpython-312.pyc differ diff --git a/tox.ini b/tox.ini new file mode 100644 index 00000000..0e4db78b --- /dev/null +++ b/tox.ini @@ -0,0 +1,14 @@ +[tox] +envlist = py39 +skipsdist = True + +[testenv] +deps = + Faker + PyQt5 + SQLAlchemy +    pytest +    pytest-cov +commands = + coverage run -m pytest + coverage xml