Skip to content

Commit

Permalink
Merge pull request #99 from saritasa-nest/dependabot/pip/pip-6f9912fb1a
Browse files Browse the repository at this point in the history
Bump the pip group with 6 updates
  • Loading branch information
OttoAndrey authored Feb 14, 2025
2 parents 857d2d4 + cb6a8e1 commit 9e7d848
Show file tree
Hide file tree
Showing 9 changed files with 134 additions and 145 deletions.
223 changes: 106 additions & 117 deletions poetry.lock

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions test_project/fake_app/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from .resources import SimpleArtistResource


class InstrumentFactory(factory.django.DjangoModelFactory):
class InstrumentFactory(factory.django.DjangoModelFactory[models.Instrument]):
"""Simple factory for ``Instrument`` model."""

title = factory.Faker("name")
Expand All @@ -18,7 +18,7 @@ class Meta:
model = models.Instrument


class ArtistFactory(factory.django.DjangoModelFactory):
class ArtistFactory(factory.django.DjangoModelFactory[models.Artist]):
"""Simple factory for ``Artist`` model."""

name = factory.Faker("name")
Expand All @@ -29,7 +29,7 @@ class Meta:
model = models.Artist


class BandFactory(factory.django.DjangoModelFactory):
class BandFactory(factory.django.DjangoModelFactory[models.Band]):
"""Simple factory for ``Band`` model."""

title = factory.Faker("company")
Expand All @@ -38,7 +38,7 @@ class Meta:
model = models.Band


class MembershipFactory(factory.django.DjangoModelFactory):
class MembershipFactory(factory.django.DjangoModelFactory[models.Membership]):
"""Simple factory for ``Membership`` model."""

artist = factory.SubFactory(ArtistFactory)
Expand All @@ -49,7 +49,7 @@ class Meta:
model = models.Membership


class ArtistImportJobFactory(factory.django.DjangoModelFactory):
class ArtistImportJobFactory(factory.django.DjangoModelFactory[ImportJob]):
"""Factory for creating ImportJob for Artist.
Usage:
Expand Down Expand Up @@ -84,7 +84,7 @@ def data_file(self):
return django_files.File(content.file, "data.csv")


class ArtistExportJobFactory(factory.django.DjangoModelFactory):
class ArtistExportJobFactory(factory.django.DjangoModelFactory[ExportJob]):
"""Factory for creating ExportJob for Artist."""

resource_path = "test_project.fake_app.resources.SimpleArtistResource"
Expand Down
12 changes: 6 additions & 6 deletions test_project/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def artist_import_job(
existing_artist: Artist,
) -> ImportJob:
"""Return `ImportJob` instance with specified artist."""
return factories.ArtistImportJobFactory(
return factories.ArtistImportJobFactory.create(
created_by=superuser,
artists=[existing_artist],
)
Expand All @@ -44,19 +44,19 @@ def artist_export_job(
superuser: User,
) -> ExportJob:
"""Return `ExportJob` instance."""
return factories.ArtistExportJobFactory(created_by=superuser)
return factories.ArtistExportJobFactory.create(created_by=superuser)


@pytest.fixture
def band() -> Band:
"""Return `Band` instance."""
return factories.BandFactory(title="Aerosmith")
return factories.BandFactory.create(title="Aerosmith")


@pytest.fixture
def membership(band: Band) -> Membership:
"""Return `Membership` instance with specified band."""
return factories.MembershipFactory(band=band)
return factories.MembershipFactory.create(band=band)


@pytest.fixture
Expand All @@ -74,9 +74,9 @@ def uploaded_file(existing_artist: Artist) -> SimpleUploadedFile:
def force_import_artist_job(
superuser: User,
new_artist: Artist,
) -> Artist:
) -> ImportJob:
"""`ImportJob` with `force_import=True` and file with invalid row."""
return ArtistImportJobFactory(
return ArtistImportJobFactory.create(
artists=[new_artist],
is_valid_file=False,
force_import=True,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def test_cancel_export_admin_action(
export_data_mock = mocker.patch(
"import_export_extensions.models.ExportJob.export_data",
)
job: ExportJob = ArtistExportJobFactory()
job = ArtistExportJobFactory.create()

response = client.post(
reverse("admin:import_export_extensions_exportjob_changelist"),
Expand Down Expand Up @@ -56,7 +56,7 @@ def test_cancel_export_admin_action_with_incorrect_export_job_status(
client.force_login(superuser)

revoke_mock = mocker.patch("celery.current_app.control.revoke")
job: ExportJob = ArtistExportJobFactory()
job = ArtistExportJobFactory.create()

expected_error_message = f"ExportJob with id {job.pk} has incorrect status"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def test_get_fieldsets_by_export_job_status(
mocker.patch(
"import_export_extensions.models.ExportJob.export_data",
)
job: ExportJob = ArtistExportJobFactory()
job = ArtistExportJobFactory.create()
job.export_status = job_status
job.save()

Expand Down
12 changes: 6 additions & 6 deletions test_project/tests/test_import_job/test_cancel.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def test_cancel_import_error_status(
incorrect.
"""
job: ImportJob = ArtistImportJobFactory(
job = ArtistImportJobFactory.create(
artists=[existing_artist, new_artist],
)
job.import_status = ImportJob.ImportStatus.PARSED
Expand All @@ -38,7 +38,7 @@ def test_cancel_import_success_status(
cancelled.
"""
job: ImportJob = ArtistImportJobFactory(
job = ArtistImportJobFactory.create(
artists=[existing_artist, new_artist],
)
job.cancel_import()
Expand All @@ -57,7 +57,7 @@ def test_cancel_import_with_celery_parse_task_id(
"""
revoke = mocker.patch("celery.current_app.control.revoke")
job: ImportJob = ArtistImportJobFactory(
job = ArtistImportJobFactory.create(
artists=[existing_artist, new_artist],
)
job.cancel_import()
Expand All @@ -79,7 +79,7 @@ def test_cancel_import_with_celery_import_task_id(
"""
revoke = mocker.patch("celery.current_app.control.revoke")
job: ImportJob = ArtistImportJobFactory(
job = ArtistImportJobFactory.create(
artists=[existing_artist, new_artist],
)
job.parse_data()
Expand All @@ -104,7 +104,7 @@ def test_cancel_import_with_custom_task_id_on_parse(
parse_data = mocker.patch(
"import_export_extensions.models.ImportJob.parse_data",
)
job: ImportJob = ArtistImportJobFactory(
job = ArtistImportJobFactory.create(
artists=[existing_artist, new_artist],
)
job.cancel_import()
Expand All @@ -129,7 +129,7 @@ def test_cancel_import_with_custom_task_id_on_import(
import_data = mocker.patch(
"import_export_extensions.models.ImportJob.import_data",
)
job: ImportJob = ArtistImportJobFactory(
job = ArtistImportJobFactory.create(
artists=[existing_artist, new_artist],
)
job.parse_data()
Expand Down
8 changes: 4 additions & 4 deletions test_project/tests/test_import_job/test_import_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def test_import_data_valid_data_file(
* import data
"""
job: ImportJob = ArtistImportJobFactory(
job = ArtistImportJobFactory.create(
artists=[
existing_artist,
new_artist,
Expand Down Expand Up @@ -60,7 +60,7 @@ def test_job_has_finished(new_artist: Artist):
and `import` part of job.
"""
job: ImportJob = ArtistImportJobFactory(artists=[new_artist])
job = ArtistImportJobFactory.create(artists=[new_artist])
assert job.parse_finished is None
assert job.import_finished is None

Expand Down Expand Up @@ -135,7 +135,7 @@ def test_force_import_create_correct_rows(
new_artist: Artist,
):
"""Test import job with `force_import=True` create correct rows."""
import_job: ImportJob = ArtistImportJobFactory(
import_job = ArtistImportJobFactory.create(
artists=[new_artist],
force_import=True,
skip_parse_step=True,
Expand Down Expand Up @@ -167,7 +167,7 @@ def test_import_create_with_max_rows(
new_artist: Artist,
):
"""Test import job max dataset rows validation."""
import_job: ImportJob = ArtistImportJobFactory(
import_job = ArtistImportJobFactory.create(
artists=[new_artist],
skip_parse_step=True,
is_valid_file=False,
Expand Down
2 changes: 1 addition & 1 deletion test_project/tests/test_import_job/test_parse_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def test_parse_data_invalid_row_file(
and skip invalid rows.
"""
import_job: ImportJob = ArtistImportJobFactory(
import_job = ArtistImportJobFactory.create(
artists=[new_artist],
force_import=force_import,
is_valid_file=False,
Expand Down
4 changes: 2 additions & 2 deletions test_project/tests/test_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,8 +353,8 @@ def test_render_empty_values(membership: Membership):
)
def test_intermediate_widget_filter_with_lookup(rem_field_lookup: str):
"""Test widget filter rem model with lookup."""
founded_band = BandFactory(title="In result band")
ignored_band = BandFactory(title="This band will be ignored")
founded_band = BandFactory.create(title="In result band")
ignored_band = BandFactory.create(title="This band will be ignored")

widget = IntermediateManyToManyWidget(
rem_model=Band,
Expand Down

0 comments on commit 9e7d848

Please sign in to comment.