Skip to content

Commit

Permalink
Instalado pytest e criado arquivo do Github CI
Browse files Browse the repository at this point in the history
close #4
  • Loading branch information
renzo authored and renzon committed Jul 4, 2024
1 parent c7df235 commit cfc0873
Show file tree
Hide file tree
Showing 11 changed files with 151 additions and 7 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/backend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Django Backend CI

on:
pull_request:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest

defaults:
run:
working-directory: backend # Set the global working directory

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1

- name: Setup Python
uses: actions/setup-python@v3
with:
python-version: "3.12"

- name: Install dependencies (using poetry)
run: |
python -m pip install --upgrade pip
python -m pip install poetry
poetry install --with dev --sync
- name: Run backend Tests
run: poetry run pytest --cache-clear
Empty file added backend/devpro/base/__init__.py
Empty file.
3 changes: 3 additions & 0 deletions backend/devpro/base/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.contrib import admin

# Register your models here.
6 changes: 6 additions & 0 deletions backend/devpro/base/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class BaseConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'devpro.base'
Empty file.
3 changes: 3 additions & 0 deletions backend/devpro/base/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.db import models

# Create your models here.
7 changes: 7 additions & 0 deletions backend/devpro/base/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from django.test import TestCase


# Create your tests here.

def test_fake():
assert True
3 changes: 3 additions & 0 deletions backend/devpro/base/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.shortcuts import render

# Create your views here.
7 changes: 1 addition & 6 deletions backend/devpro/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/5.0/howto/deployment/checklist/

Expand All @@ -27,7 +26,6 @@

ALLOWED_HOSTS = []


# Application definition

INSTALLED_APPS = [
Expand All @@ -37,6 +35,7 @@
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'devpro.base',
]

MIDDLEWARE = [
Expand Down Expand Up @@ -69,7 +68,6 @@

WSGI_APPLICATION = 'devpro.wsgi.application'


# Database
# https://docs.djangoproject.com/en/5.0/ref/settings/#databases

Expand All @@ -80,7 +78,6 @@
}
}


# Password validation
# https://docs.djangoproject.com/en/5.0/ref/settings/#auth-password-validators

Expand All @@ -99,7 +96,6 @@
},
]


# Internationalization
# https://docs.djangoproject.com/en/5.0/topics/i18n/

Expand All @@ -111,7 +107,6 @@

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/5.0/howto/static-files/

Expand Down
88 changes: 87 additions & 1 deletion backend/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions backend/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ python = "^3.12"
django = ">4"


[tool.poetry.group.dev.dependencies]
pytest = "^8.2.2"
pytest-django = "^4.8.0"

[tool.pytest.ini_options]
DJANGO_SETTINGS_MODULE = "devpro.settings"
python_files = ["test*.py", "*test.py", "testing/python/*.py"]

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

0 comments on commit cfc0873

Please sign in to comment.