Skip to content

Commit

Permalink
Updating Python to 3.12 (#4325)
Browse files Browse the repository at this point in the history
* Updating Python to 3.12

* Updating runtime.txt

* Replacing removed assertEquals with assertEqual

* Replacing removed assertAlmostEquals with assertAlmostEqual
  • Loading branch information
phildominguez-gsa authored Sep 27, 2024
1 parent 773d171 commit e0d9ef5
Show file tree
Hide file tree
Showing 15 changed files with 1,297 additions and 1,188 deletions.
8 changes: 4 additions & 4 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
# FOUNDATION
###############################

FROM python:3.11-slim AS foundation
FROM python:3.12-slim AS foundation

ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1

RUN apt-get -yq update && \
apt install -y \
apt-transport-https \
apt-transport-https \
build-essential \
ca-certificates \
chromium \
Expand All @@ -19,7 +19,7 @@ RUN apt-get -yq update && \
gnupg \
gnupg2 \
postgresql-client \
wget
wget

###############################
# STORAGE
Expand Down Expand Up @@ -62,7 +62,7 @@ RUN npm ci && \

COPY . /src/

RUN npm run build
RUN npm run build

###############################
# DEV
Expand Down
12 changes: 6 additions & 6 deletions backend/api/test_serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -574,14 +574,14 @@ def test_expected_fields_included(self):

serializer = AccessListSerializer(access)

self.assertEquals(serializer.data["auditee_uei"], access.sac.auditee_uei)
self.assertEquals(
self.assertEqual(serializer.data["auditee_uei"], access.sac.auditee_uei)
self.assertEqual(
serializer.data["auditee_fiscal_period_end"],
access.sac.auditee_fiscal_period_end,
)
self.assertEquals(serializer.data["auditee_name"], access.sac.auditee_name)
self.assertEquals(serializer.data["report_id"], access.sac.report_id)
self.assertEquals(
self.assertEqual(serializer.data["auditee_name"], access.sac.auditee_name)
self.assertEqual(serializer.data["report_id"], access.sac.report_id)
self.assertEqual(
serializer.data["submission_status"], access.sac.submission_status
)
self.assertEquals(serializer.data["role"], access.role)
self.assertEqual(serializer.data["role"], access.role)
12 changes: 6 additions & 6 deletions backend/api/test_uei.py
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ def test_get_uei_info_from_sam_gov(self):

self.assertFalse(results["valid"])
self.assertTrue(results["errors"])
self.assertEquals(
self.assertEqual(
results["errors"],
["SAM.gov API response status code invalid: 400"],
)
Expand All @@ -520,7 +520,7 @@ def bad_timeout(*args, **kwds):

self.assertFalse(results["valid"])
self.assertTrue(results["errors"])
self.assertEquals(results["errors"], ["SAM.gov API timeout"])
self.assertEqual(results["errors"], ["SAM.gov API timeout"])

# TooManyRedirects
with patch("api.uei.SESSION.get") as mock_get:
Expand All @@ -533,7 +533,7 @@ def bad_redirects(*args, **kwds):

self.assertFalse(results["valid"])
self.assertTrue(results["errors"])
self.assertEquals(
self.assertEqual(
results["errors"], ["SAM.gov API error - too many redirects"]
)

Expand All @@ -548,7 +548,7 @@ def bad_reqexception(*args, **kwds):

self.assertFalse(results["valid"])
self.assertTrue(results["errors"])
self.assertEquals(
self.assertEqual(
results["errors"],
["Unable to make SAM.gov API request, error: "],
)
Expand All @@ -574,7 +574,7 @@ def bad_reqexception(*args, **kwds):

self.assertFalse(results["valid"])
self.assertTrue(results["errors"])
self.assertEquals(
self.assertEqual(
results["errors"],
["UEI was not found in SAM.gov"],
)
Expand Down Expand Up @@ -609,7 +609,7 @@ def bad_reqexception(*args, **kwds):

self.assertFalse(results["valid"])
self.assertTrue(results["errors"])
self.assertEquals(
self.assertEqual(
results["errors"],
["UEI was not found in SAM.gov"],
)
Expand Down
6 changes: 3 additions & 3 deletions backend/audit/test_intake_to_dissemination.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ def test_load_general(self):
general.total_amount_expended,
self.sac.federal_awards["FederalAwards"].get("total_amount_expended"),
)
self.assertEquals(
self.assertEqual(
Util.json_array_to_str(self.sac.audit_information["gaap_results"]),
general.gaap_results,
)
Expand All @@ -439,7 +439,7 @@ def test_load_general_race_condition_logging(self):
with mock.patch.object(logger, "warning") as mock_warning:
self.intake_to_dissemination.save_dissemination_objects()
mock_warning.assert_called()
self.assertEquals(1, len(self.intake_to_dissemination.errors))
self.assertEqual(1, len(self.intake_to_dissemination.errors))

def test_submitted_date(self):
"""
Expand Down Expand Up @@ -560,7 +560,7 @@ def test_load_sec_auditor(self):
sec_auditor = SecondaryAuditor.objects.first()
print(self.sac.report_id)
print(sec_auditor.report_id)
self.assertEquals(self.sac.report_id, sec_auditor.report_id.report_id)
self.assertEqual(self.sac.report_id, sec_auditor.report_id.report_id)

def test_load_additional_ueis(self):
self.intake_to_dissemination.load_general()
Expand Down
6 changes: 3 additions & 3 deletions backend/audit/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,12 +224,12 @@ def setUp(self):

def test_redirect_if_not_logged_in(self):
result = self.client.get(SUBMISSIONS_PATH)
self.assertAlmostEquals(result.status_code, 302)
self.assertAlmostEqual(result.status_code, 302)

def test_no_submissions_returns_empty_list(self):
self.client.force_login(user=self.user)
data = MySubmissions.fetch_my_submissions(self.user)
self.assertEquals(len(data), 0)
self.assertEqual(len(data), 0)

def test_user_with_submissions_should_return_expected_data_columns(self):
self.client.force_login(user=self.user)
Expand Down Expand Up @@ -260,7 +260,7 @@ def test_user_with_no_submissions_should_return_no_data(self):
ACCESS_AND_SUBMISSION_PATH, VALID_ACCESS_AND_SUBMISSION_DATA, format="json"
)
data = MySubmissions.fetch_my_submissions(self.user2)
self.assertEquals(len(data), 0)
self.assertEqual(len(data), 0)


class EditSubmissionViewTests(TestCase):
Expand Down
24 changes: 12 additions & 12 deletions backend/census_historical_migration/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,81 +27,81 @@ def test_can_load_elecauditheader_model(self):
self.assertIsNotNone(gen)
baker.make(ELECAUDITHEADER).save()
gen = ELECAUDITHEADER.objects.all()
self.assertEquals(len(gen), 1)
self.assertEqual(len(gen), 1)

def test_can_load_eleceins_model(self):
elec_eins = ELECEINS.objects.all()
self.assertIsNotNone(elec_eins)
baker.make(ELECEINS).save()
elec_eins = ELECEINS.objects.all()
self.assertEquals(len(elec_eins), 1)
self.assertEqual(len(elec_eins), 1)

def test_can_load_elecauditfindings_model(self):
elec_audit_findings = ELECAUDITFINDINGS.objects.all()
self.assertIsNotNone(elec_audit_findings)
baker.make(ELECAUDITFINDINGS).save()
elec_audit_findings = ELECAUDITFINDINGS.objects.all()
self.assertEquals(len(elec_audit_findings), 1)
self.assertEqual(len(elec_audit_findings), 1)

def test_can_load_elecnotes_model(self):
elec_notes = ELECNOTES.objects.all()
self.assertIsNotNone(elec_notes)
baker.make(ELECNOTES).save()
elec_notes = ELECNOTES.objects.all()
self.assertEquals(len(elec_notes), 1)
self.assertEqual(len(elec_notes), 1)

def test_can_load_elecfindingstext_model(self):
elec_findingstext = ELECFINDINGSTEXT.objects.all()
self.assertIsNotNone(elec_findingstext)
baker.make(ELECFINDINGSTEXT).save()
elec_findingstext = ELECFINDINGSTEXT.objects.all()
self.assertEquals(len(elec_findingstext), 1)
self.assertEqual(len(elec_findingstext), 1)

def test_can_load_eleccpas_model(self):
elec_cpas = ELECCPAS.objects.all()
self.assertIsNotNone(elec_cpas)
baker.make(ELECCPAS).save()
elec_cpas = ELECCPAS.objects.all()
self.assertEquals(len(elec_cpas), 1)
self.assertEqual(len(elec_cpas), 1)

def test_can_load_elecaudits_model(self):
elec_audits = ELECAUDITS.objects.all()
self.assertIsNotNone(elec_audits)
baker.make(ELECAUDITS).save()
elec_audits = ELECAUDITS.objects.all()
self.assertEquals(len(elec_audits), 1)
self.assertEqual(len(elec_audits), 1)

def test_can_load_elecpassthrough_model(self):
elec_passthrough = ELECPASSTHROUGH.objects.all()
self.assertIsNotNone(elec_passthrough)
baker.make(ELECPASSTHROUGH).save()
elec_passthrough = ELECPASSTHROUGH.objects.all()
self.assertEquals(len(elec_passthrough), 1)
self.assertEqual(len(elec_passthrough), 1)

def test_can_load_elecueis_model(self):
elec_ueis = ELECUEIS.objects.all()
self.assertIsNotNone(elec_ueis)
baker.make(ELECUEIS).save()
elec_ueis = ELECUEIS.objects.all()
self.assertEquals(len(elec_ueis), 1)
self.assertEqual(len(elec_ueis), 1)

def test_can_load_eleccaptext_model(self):
elec_captext = ELECCAPTEXT.objects.all()
self.assertIsNotNone(elec_captext)
baker.make(ELECCAPTEXT).save()
elec_captext = ELECCAPTEXT.objects.all()
self.assertEquals(len(elec_captext), 1)
self.assertEqual(len(elec_captext), 1)

def test_can_load_report_migration_status_model(self):
report_migration_status = ReportMigrationStatus.objects.all()
self.assertIsNotNone(report_migration_status)
baker.make(ReportMigrationStatus).save()
report_migration_status = ReportMigrationStatus.objects.all()
self.assertEquals(len(report_migration_status), 1)
self.assertEqual(len(report_migration_status), 1)

def test_can_load_migration_error_detail_model(self):
migration_error_detail = MigrationErrorDetail.objects.all()
self.assertIsNotNone(migration_error_detail)
baker.make(MigrationErrorDetail).save()
migration_error_detail = MigrationErrorDetail.objects.all()
self.assertEquals(len(migration_error_detail), 1)
self.assertEqual(len(migration_error_detail), 1)
Loading

0 comments on commit e0d9ef5

Please sign in to comment.