diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3e26ae6..e5a13b6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -119,6 +119,7 @@ jobs: uses: psf/black@stable with: version: "23.3.0" # Last version which can be used in py3.7 + options: "--check --verbose" - uses: actions/checkout@v3 - name: ruff-action uses: chartboost/ruff-action@v1 diff --git a/tests/builders/test_model_builder.py b/tests/builders/test_model_builder.py index b85d038..19e9066 100644 --- a/tests/builders/test_model_builder.py +++ b/tests/builders/test_model_builder.py @@ -8,8 +8,8 @@ def test_builds_relationship(self): def test_parent_has_access_to_versioning_manager(self): assert self.Article.__versioning_manager__ -class TestGenericReprModelBuilder(TestCase): +class TestGenericReprModelBuilder(TestCase): @property def options(self): return { @@ -27,8 +27,8 @@ def test_version_cls_repr(self): self.session.commit() assert repr(article.versions[0]) == "ArticleVersion(id=1, transaction_id=1, operation_type=0)" -class TestNoGenericReprModelBuilder(TestCase): +class TestNoGenericReprModelBuilder(TestCase): @property def options(self): class ReprMixin: @@ -37,7 +37,7 @@ def __repr__(self): return { "create_models": self.should_create_models, - "base_classes": (self.Model,ReprMixin), + "base_classes": (self.Model, ReprMixin), "strategy": self.versioning_strategy, "transaction_column_name": self.transaction_column_name, "end_transaction_column_name": self.end_transaction_column_name, diff --git a/tests/plugins/test_activity.py b/tests/plugins/test_activity.py index 275c698..12fdc6d 100644 --- a/tests/plugins/test_activity.py +++ b/tests/plugins/test_activity.py @@ -35,8 +35,12 @@ def create_activity(self, object=None, target=None): ) self.session.add(activity) return activity + + # ref : https://github.com/kvesteri/sqlalchemy-utils/issues/719 -@pytest.mark.skipif(str(sa.__version__).startswith('2.'), reason="sqla-utils generic relations has issue with sqla 2.x") +@pytest.mark.skipif( + str(sa.__version__).startswith("2."), reason="sqla-utils generic relations has issue with sqla 2.x" +) class TestActivityNotId(ActivityTestCase): def create_models(self): TestCase.create_models(self) @@ -63,8 +67,12 @@ def test_create_activity_with_pk(self): assert activity.transaction_id assert activity.object == not_id_model assert activity.object_version == not_id_model.versions.all()[-1] + + # ref : https://github.com/kvesteri/sqlalchemy-utils/issues/719 -@pytest.mark.skipif(str(sa.__version__).startswith('2.'), reason="sqla-utils generic relations has issue with sqla 2.x") +@pytest.mark.skipif( + str(sa.__version__).startswith("2."), reason="sqla-utils generic relations has issue with sqla 2.x" +) class TestActivity(ActivityTestCase): def test_creates_activity_class(self): assert versioning_manager.activity_cls.__name__ == "Activity" @@ -123,8 +131,11 @@ def test_activity_queries(self): ) assert activities.count() == 2 + # ref : https://github.com/kvesteri/sqlalchemy-utils/issues/719 -@pytest.mark.skipif(str(sa.__version__).startswith('2.'), reason="sqla-utils generic relations has issue with sqla 2.x") +@pytest.mark.skipif( + str(sa.__version__).startswith("2."), reason="sqla-utils generic relations has issue with sqla 2.x" +) class TestObjectTxIdGeneration(ActivityTestCase): def test_does_not_query_db_if_version_obj_in_session(self): article = self.create_article() @@ -146,8 +157,11 @@ def test_create_activity_with_multiple_existing_objects(self): assert activity.object == article assert activity.object_version == article.versions.all()[-1] + # ref : https://github.com/kvesteri/sqlalchemy-utils/issues/719 -@pytest.mark.skipif(str(sa.__version__).startswith('2.'), reason="sqla-utils generic relations has issue with sqla 2.x") +@pytest.mark.skipif( + str(sa.__version__).startswith("2."), reason="sqla-utils generic relations has issue with sqla 2.x" +) class TestTargetTxIdGeneration(ActivityTestCase): def test_does_not_query_db_if_version_obj_in_session(self): article = self.create_article() diff --git a/tests/test_association_proxy.py b/tests/test_association_proxy.py index efd64da..d4da614 100644 --- a/tests/test_association_proxy.py +++ b/tests/test_association_proxy.py @@ -10,7 +10,9 @@ class Article(self.Model): __tablename__ = "article" __versioned__ = {} - id = sa.Column(sa.Integer, sa.Sequence(f"{__tablename__}_seq", start=1), autoincrement=True, primary_key=True) + id = sa.Column( + sa.Integer, sa.Sequence(f"{__tablename__}_seq", start=1), autoincrement=True, primary_key=True + ) name = sa.Column(sa.Unicode(255), nullable=False) content = sa.Column(sa.UnicodeText) description = sa.Column(sa.UnicodeText) @@ -21,7 +23,9 @@ class Tag(self.Model): __tablename__ = "tag" __versioned__ = {} - id = sa.Column(sa.Integer, sa.Sequence(f"{__tablename__}_seq", start=1), autoincrement=True, primary_key=True) + id = sa.Column( + sa.Integer, sa.Sequence(f"{__tablename__}_seq", start=1), autoincrement=True, primary_key=True + ) name = sa.Column(sa.Unicode(255)) article_id = sa.Column(sa.Integer, sa.ForeignKey(Article.id)) article = sa.orm.relationship(Article, backref="tags") diff --git a/tests/test_i18n.py b/tests/test_i18n.py index 250c9e2..598def8 100644 --- a/tests/test_i18n.py +++ b/tests/test_i18n.py @@ -11,7 +11,7 @@ make_translatable() -@pytest.mark.skipif(str(sa.__version__).startswith('2.'), reason="i18n doesn't support sqla 2.0 yet") +@pytest.mark.skipif(str(sa.__version__).startswith("2."), reason="i18n doesn't support sqla 2.0 yet") class TestVersioningWithI18nExtension(TestCase): def create_models(self): class Versioned(self.Model):