Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
SamDudley committed Mar 22, 2024
1 parent 71bd7c5 commit f48bbcf
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 31 deletions.
26 changes: 9 additions & 17 deletions end_of_month/test/test_end_of_month_process.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import pytest
from django.db.models import F
from django.test import TestCase

Expand Down Expand Up @@ -111,18 +112,13 @@ def test_end_of_month_mar(self):
self.assertEqual(count, 129)


class ReadArchivedForecastTest(TestCase):
@classmethod
def setUpTestData(cls):
cls.archived_figure = []

def setUp(self):
class TestReadArchivedForecastTest:
@pytest.fixture(autouse=True)
def _setup(self):
self.archived_figure = [0 for _ in range(16)]
self.init_data = MonthlyFigureSetup()
self.init_data.setup_forecast()

for period in range(0, 16):
self.archived_figure.append(0)

def get_period_total(self, period):
data_model = forecast_budget_view_model[period]
tot_q = data_model.objects.filter(
Expand Down Expand Up @@ -335,16 +331,12 @@ def test_end_of_month_mar(self):
self.assertEqual(budget_total_count, 12)


class ReadArchivedBudgetTest(TestCase):
@classmethod
def setUpTestData(cls):
cls.archived_figure = []

def setUp(self):
class TestReadArchivedBudgetTest:
@pytest.fixture(autouse=True)
def _setup(self):
self.archived_figure = [0 for _ in range(16)]
self.init_data = MonthlyFigureSetup()
self.init_data.setup_budget()
for period in range(0, 16):
self.archived_figure.append(0)

def get_period_budget_total(self, period):
data_model = forecast_budget_view_model[period]
Expand Down
14 changes: 5 additions & 9 deletions end_of_month/test/test_outturn_variance.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
import pytest
from django.db.models import F
from django.test import TestCase

from end_of_month.end_of_month_actions import end_of_month_archive
from end_of_month.models import forecast_budget_view_model
from end_of_month.test.test_utils import MonthlyFigureSetup


class ReadMonthlyVarianceTest(TestCase):
@classmethod
def setUpTestData(cls):
cls.archived_figure = []

def setUp(self):
class TestReadMonthlyVarianceTest:
@pytest.fixture(autouse=True)
def _setup(self):
self.archived_figure = [0 for _ in range(16)]
self.init_data = MonthlyFigureSetup()
self.init_data.setup_forecast()
for period in range(0, 16):
self.archived_figure.append(0)

def get_period_total(self, period):
data_model = forecast_budget_view_model[period]
Expand Down
4 changes: 2 additions & 2 deletions future_years/test/test_end_of_month_archive_budget.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

from core.utils.generic_helpers import get_current_financial_year
from end_of_month.end_of_month_actions import end_of_month_archive
from end_of_month.test.test_end_of_month_process import ReadArchivedBudgetTest
from end_of_month.test.test_end_of_month_process import TestReadArchivedBudgetTest
from end_of_month.test.test_utils import MonthlyFigureSetup
from forecast.models import BudgetMonthlyFigure


class ReadArchivedFutureDataForecast(ReadArchivedBudgetTest):
class ReadArchivedFutureDataForecast(TestReadArchivedBudgetTest):
def setUp(self):
super().setUp()
current_year = get_current_financial_year()
Expand Down
4 changes: 2 additions & 2 deletions future_years/test/test_end_of_month_archive_forecast.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

from core.utils.generic_helpers import get_current_financial_year
from end_of_month.end_of_month_actions import end_of_month_archive
from end_of_month.test.test_end_of_month_process import ReadArchivedForecastTest
from end_of_month.test.test_end_of_month_process import TestReadArchivedForecastTest
from end_of_month.test.test_utils import MonthlyFigureSetup
from forecast.models import ForecastMonthlyFigure


class ReadArchivedFutureDataForecast(ReadArchivedForecastTest):
class ReadArchivedFutureDataForecast(TestReadArchivedForecastTest, TestCase):
def setUp(self):
super().setUp()
current_year = get_current_financial_year()
Expand Down
2 changes: 1 addition & 1 deletion makefile
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ test:
docker-compose run --rm web python manage.py test $(test)

pytest:
docker-compose run --rm web pytest --ignore=node_modules --ignore=front_end --ignore=features --ignore=staticfiles -v --random-order
docker-compose run --rm web pytest --ignore=node_modules --ignore=front_end --ignore=features --ignore=staticfiles --random-order -n 4 -v

black-check:
docker-compose run --rm --no-deps web black --check .
Expand Down

0 comments on commit f48bbcf

Please sign in to comment.