Skip to content

Commit

Permalink
Merge pull request #80 from esnet-security/topic/vlad/coveralls
Browse files Browse the repository at this point in the history
Coveralls integration
  • Loading branch information
grigorescu authored Nov 18, 2024
2 parents 25e1069 + 5fecad9 commit 55e0cc9
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 14 deletions.
3 changes: 0 additions & 3 deletions .coveragerc

This file was deleted.

6 changes: 5 additions & 1 deletion .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Run pytest

on:
Expand Down Expand Up @@ -59,7 +60,10 @@ jobs:
POSTGRES_DB: test_scram
run: make coverage.xml

- name: Upload Coverage Report
- name: Upload Coverage to Coveralls
uses: coverallsapp/github-action@v2

- name: Upload Coverage to GitHub
uses: actions/upload-artifact@v4
with:
name: coverage-report
Expand Down
4 changes: 3 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ SCRAM

Security Catch and Release Automation Manager

.. image:: https://coveralls.io/repos/github/esnet-security/SCRAM/badge.svg
:target: https://coveralls.io/github/esnet-security/SCRAM
:alt: Coveralls Code Coverage Stats
.. image:: https://img.shields.io/badge/built%20with-Cookiecutter%20Django-ff69b4.svg?logo=cookiecutter
:target: https://github.com/pydanny/cookiecutter-django/
:alt: Built with Cookiecutter Django
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
:target: https://github.com/ambv/black
:alt: Black code style


:License: BSD

====
Expand Down
12 changes: 6 additions & 6 deletions config/asgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@
from django.core.asgi import get_asgi_application

# Here we setup a debugger if this is desired. This obviously should not be run in production.
debug_mode = os.environ.get("DEBUG")
if debug_mode:
logging.info(f"Django is set to use a debugger. Provided debug mode: {debug_mode}")
if debug_mode == "pycharm-pydevd":
debug = os.environ.get("DEBUG")
if debug:
logging.info(f"Django is set to use a debugger. Provided debug mode: {debug}")
if debug == "pycharm-pydevd":
logging.info("Entering debug mode for pycharm, make sure the debug server is running in PyCharm!")

import pydevd_pycharm

pydevd_pycharm.settrace("host.docker.internal", port=56783, stdoutToServer=True, stderrToServer=True)

logging.info("Debugger started.")
elif debug_mode == "debugpy":
elif debug == "debugpy":
logging.info("Entering debug mode for debugpy (VSCode)")

import debugpy
Expand All @@ -39,7 +39,7 @@

logging.info("Debugger listening on port 56780.")
else:
logging.warning(f"Invalid debug mode given: {debug_mode}. Debugger not started")
logging.warning(f"Invalid debug mode given: {debug}. Debugger not started")

# This allows easy placement of apps within the interior
# scram directory.
Expand Down
4 changes: 4 additions & 0 deletions config/settings/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
# http://whitenoise.evans.io/en/latest/django.html#using-whitenoise-in-development
INSTALLED_APPS = ["whitenoise.runserver_nostatic"] + INSTALLED_APPS # noqa F405

# django-coverage-plugin
# ------------------------------------------------------------------------------
# https://github.com/nedbat/django_coverage_plugin?tab=readme-ov-file#django-template-coveragepy-plugin
TEMPLATES[0]["OPTIONS"]['debug'] = True # noqa F405

# django-debug-toolbar
# ------------------------------------------------------------------------------
Expand Down
14 changes: 12 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,18 @@ python_files = [
include = ["scram/*", "config/*", "translator/*"]
omit = ["**/migrations/*", "scram/contrib/*", "*/tests/*"]
plugins = ["django_coverage_plugin"]


branch = true
data_file = "coverage.coverage"

[tool.coverage.report]
exclude_also = [
"if debug:",
"if self.debug:",
"if settings.DEBUG",
"raise AssertionError",
"raise NotImplementedError",
"if __name__ == .__main__.:",
]

# ==== black ====
[tool.black]
Expand Down
2 changes: 1 addition & 1 deletion requirements/local.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ factory-boy==3.2.1 # https://github.com/FactoryBoy/factory_boy

django-debug-toolbar==3.4.0 # https://github.com/jazzband/django-debug-toolbar
django-extensions==3.1.5 # https://github.com/django-extensions/django-extensions
django-coverage-plugin==2.0.3 # https://github.com/nedbat/django_coverage_plugin
django-coverage-plugin==3.1.0 # https://github.com/nedbat/django_coverage_plugin
pytest-django==4.5.2 # https://github.com/pytest-dev/pytest-django

# Debugging
Expand Down

0 comments on commit 55e0cc9

Please sign in to comment.