TT#121955 define pytest config

* coverage:
  - omit tests files
  - define data_file
* force django in debug mode
* remove warning

> gerrit/test_commands.py::refreshTest::test_today_format_ko
>   /code/gerrit/test_commands.py:101: DeprecationWarning: Please use assertRaisesRegex instead.
>     with self.assertRaisesRegexp(

Change-Id: Ia63ba02a8afa27aecd5d0643d665ed4baaaaa24c
master
Victor Seva 1 year ago
parent 732bc07748
commit 797d6551b2

@ -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 \

@ -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")

@ -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",
]

@ -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

Loading…
Cancel
Save