diff --git a/Makefile b/Makefile
index 281c6f8..0196db9 100644
--- a/Makefile
+++ b/Makefile
@@ -22,7 +22,8 @@ venv_dev: requirements/dev.txt
 test: test_templates
 	RESULTS=$(RESULTS) pytest-3 -ra --junitxml=$(RESULTS)/junit.xml \
 		-o cache_dir=$(CACHE_DIR) \
-		--cov=. --cov-report=xml:$(RESULTS)/coverage.xml --pep8
+		--cov=. --cov-report=xml:$(RESULTS)/coverage.xml --cov-config=pyproject.toml \
+		--pep8
 
 test_pylint:
 	RESULTS=$(RESULTS) pytest-3 --junitxml=$(RESULTS)/junit.xml \
diff --git a/gerrit/test_commands.py b/gerrit/test_commands.py
index 9aab2c6..d773382 100644
--- a/gerrit/test_commands.py
+++ b/gerrit/test_commands.py
@@ -98,7 +98,7 @@ class refreshTest(TestCase):
 
     @patch("gerrit.management.commands.gerrit.tasks")
     def test_today_format_ko(self, tasks):
-        with self.assertRaisesRegexp(
+        with self.assertRaisesRegex(
             CommandError, "invalid fromisoformat value"
         ):
             call_command("gerrit", "cleanup", "--today=2023-12-19T12:39:58")
diff --git a/pyproject.toml b/pyproject.toml
index f4c5929..44177b3 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -7,3 +7,15 @@ exclude = '''
   | __pycache__
 )/
 '''
+[tool.pytest.ini_options]
+#FAIL_INVALID_TEMPLATE_VARS = true
+django_debug_mode = true
+DJANGO_SETTINGS_MODULE = "repoapi.settings.test"
+pep8ignore = "*.py W503"
+[tool.coverage.run]
+data_file = "/results/.coverage"
+omit = [
+  "*/test/*",
+  "*/tests/*",
+  "*/test_*.py",
+]
\ No newline at end of file
diff --git a/repoapi/test/test_settings.py b/repoapi/test/test_settings.py
index 7d977ff..558aa07 100644
--- a/repoapi/test/test_settings.py
+++ b/repoapi/test/test_settings.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2020 The Sipwise Team - http://sipwise.com
+# Copyright (C) 2020-2024 The Sipwise Team - http://sipwise.com
 #
 # This program is free software: you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by the Free
@@ -12,8 +12,6 @@
 #
 # You should have received a copy of the GNU General Public License along
 # with this program.  If not, see <http://www.gnu.org/licenses/>.
-import unittest
-
 from django.test import override_settings
 from django.test import SimpleTestCase
 
@@ -24,7 +22,6 @@ class SettingsTest(SimpleTestCase):
 
         self.assertTrue(DEBUG)
 
-    @unittest.expectedFailure
     def test_debug(self):
         from django.conf import settings