diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index cdbe11e..3df6929 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -12,8 +12,6 @@ jobs: uses: 20c/workflows/poetry@v1 - name: Run linters run: | - poetry run isort src/ - poetry run black --check src/ poetry run pre-commit run --all-files test: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b81a570..be724fb 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -15,16 +15,9 @@ repos: hooks: # Run the linter. - id: ruff - args: [ --fix ] + args: ["--select", "I", "--fix"] # Run the formatter. - id: ruff-format - - repo: local - hooks: - - id: system - name: isort - entry: poetry run isort . - language: system - pass_filenames: false - repo: local hooks: - id: pyupgrade @@ -32,18 +25,4 @@ repos: entry: poetry run pyupgrade --py38-plus language: python types: [python] - pass_filenames: true - - repo: local - hooks: - - id: system - name: Black - entry: poetry run black . - language: system - pass_filenames: false - - repo: local - hooks: - - id: system - name: flake8 - entry: poetry run flake8 . - language: system - pass_filenames: false \ No newline at end of file + pass_filenames: true \ No newline at end of file diff --git a/src/django_peeringdb/migrations/0034_fix_voltage.py b/src/django_peeringdb/migrations/0034_fix_voltage.py index fd1e3fc..905daf9 100644 --- a/src/django_peeringdb/migrations/0034_fix_voltage.py +++ b/src/django_peeringdb/migrations/0034_fix_voltage.py @@ -22,9 +22,9 @@ def forward(apps, schema_editor): try: # overide from_db_value method # because this method calls "clean_choices" resulting in a validation error when retrieving all facilites. - Facility._meta.get_field("available_voltage_services").from_db_value = ( - _from_db_value - ) + Facility._meta.get_field( + "available_voltage_services" + ).from_db_value = _from_db_value facilities = Facility.handleref.all() for facility in facilities: voltage = facility.available_voltage_services @@ -42,9 +42,9 @@ def forward(apps, schema_editor): print(f"Removed {removed} from {facility}") facility.save() finally: - Facility._meta.get_field("available_voltage_services").from_db_value = ( - from_db_value - ) + Facility._meta.get_field( + "available_voltage_services" + ).from_db_value = from_db_value updated_field.auto_now = updated_field_auto_now diff --git a/tests/models.py b/tests/models.py index a0d18e6..b1c3688 100644 --- a/tests/models.py +++ b/tests/models.py @@ -1,5 +1,4 @@ from django.db import models - from django_peeringdb.models import LG_URLField, MultipleChoiceField, URLField diff --git a/tests/test_client_adaptor.py b/tests/test_client_adaptor.py index fa319c5..b5ab85c 100644 --- a/tests/test_client_adaptor.py +++ b/tests/test_client_adaptor.py @@ -5,17 +5,16 @@ from decimal import Decimal import django.core.exceptions +import django_peeringdb.models as models import pytest from django.db import IntegrityError from django.db.transaction import atomic as atomic_transaction - -import django_peeringdb.models as models +from django_peeringdb.client_adaptor.load import database_settings # import order is important here, linters will complain # about the backend import not being on top of the file # TODO: find better way to handle this import tests.peeringdb_mock # noqa -from django_peeringdb.client_adaptor.load import database_settings sys.modules["peeringdb"] = sys.modules["tests.peeringdb_mock"] # noqa from django_peeringdb.client_adaptor.backend import Backend # noqa diff --git a/tests/test_concrete_models.py b/tests/test_concrete_models.py index b22623c..893c33a 100644 --- a/tests/test_concrete_models.py +++ b/tests/test_concrete_models.py @@ -1,5 +1,4 @@ import pytest - from django_peeringdb.models import Carrier, CarrierFacility, Facility, Organization diff --git a/tests/test_core.py b/tests/test_core.py index 31a4371..0dcb8d2 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -1,6 +1,5 @@ -from django.test import TestCase - import django_peeringdb.models +from django.test import TestCase class CoreTests(TestCase): diff --git a/tests/test_models.py b/tests/test_models.py index 1c31320..09d5647 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -1,8 +1,8 @@ import pytest from django.core.exceptions import ValidationError from django.test import TestCase - from django_peeringdb.models import LG_URLField, URLField + from tests.models import FieldModel, LG_FieldModel