diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 643f064..bcac553 100755 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,7 +39,7 @@ jobs: # uses: pre-commit/action@v3.0.0 # With no caching at all the entire ci process takes 4m 30s to complete! - pytest: + tests: runs-on: ubuntu-latest steps: @@ -54,7 +54,10 @@ jobs: run: docker compose -f local.yml run --rm django python manage.py migrate - name: Run Django Tests - run: docker compose -f local.yml run django pytest || true + run: docker compose -f local.yml run --rm django python manage.py test --settings=config.settings.test + + - name: Run Pytest + run: docker compose -f local.yml run --rm django pytest - name: Tear down the Stack run: docker compose -f local.yml down diff --git a/Makefile b/Makefile index ce98fe5..3023b82 100755 --- a/Makefile +++ b/Makefile @@ -78,10 +78,19 @@ django_bash: ## Open a bash terminar from django container using $(compose) @docker compose -f $(compose) run --rm django bash django_test: ## Run tests from django container using $(compose) - @docker compose -f $(compose) run --rm django python manage.py test + @docker compose -f $(compose) run --rm django python manage.py test --settings=config.settings.test django_fast: ## Run tests fast from django container using $(compose) - @docker compose -f $(compose) run --rm django python manage.py test --failfast + @docker compose -f $(compose) run --rm django python manage.py test --settings=config.settings.test --failfast + +pytest: ## Run pytest from django container using $(compose) + @docker compose -f $(compose) run --rm django pytest + +pytest_fast: ## Run pytest stopping on first failure using $(compose) + @docker compose -f $(compose) run --rm django pytest -x + +pytest_cov: ## Run pytest with coverage report using $(compose) + @docker compose -f $(compose) run --rm django pytest --cov --cov-report=term-missing django_makemigrations: ## Run makemigrations from django container using $(compose) @docker compose -f $(compose) run --rm django python manage.py makemigrations diff --git a/requirements/local.txt b/requirements/local.txt index 41e8cbf..cadc3d0 100644 --- a/requirements/local.txt +++ b/requirements/local.txt @@ -8,4 +8,8 @@ watchgod==0.8.2 # https://github.com/samuelcolvin/watchgod django-extensions==3.2.3 # https://github.com/django-extensions/django-extensions django-debug-toolbar # https://github.com/jazzband/django-debug-toolbar -pytest >= 7.0.7 \ No newline at end of file +pytest==8.3.5 +pytest-django==4.11.1 +pytest-cov==6.1.1 +coverage==7.8.0 +django-coverage-plugin==3.1.0 \ No newline at end of file diff --git a/setup.cfg b/setup.cfg index 3017a04..42ad946 100644 --- a/setup.cfg +++ b/setup.cfg @@ -34,7 +34,16 @@ django_settings_module = config.settings.test ignore_errors = True [coverage:run] -include = core/* -omit = *migrations*, *tests* +include = + users/* + core/* + core_settings/* + markup_doc/* + markuplib/* + xml_manager/* + reference/* + tracker/* + model_ai/* +omit = *migrations*, *tests*, */tests/* plugins = django_coverage_plugin diff --git a/users/tests.py b/users/tests.py index 7ce503c..4661003 100644 --- a/users/tests.py +++ b/users/tests.py @@ -1,3 +1,8 @@ -from django.test import TestCase +from django.test import SimpleTestCase -# Create your tests here. +from users.models import CustomUser + + +class SmokeTestCase(SimpleTestCase): + def test_custom_user_model_is_configured(self): + self.assertEqual(CustomUser._meta.label, "users.CustomUser")