Skip to content

Commit

Permalink
chore: fix black option to check for formatting
Browse files Browse the repository at this point in the history
lint job was not checking for format but formatting it so it was
not failing added check flag.
formatted files that needed to be formatted
  • Loading branch information
indiVar0508 committed Nov 29, 2023
1 parent 235cbbb commit f94ff1b
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 10 deletions.
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions tests/builders/test_model_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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:
Expand All @@ -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,
Expand Down
22 changes: 18 additions & 4 deletions tests/plugins/test_activity.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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"
Expand Down Expand Up @@ -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()
Expand All @@ -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()
Expand Down
8 changes: 6 additions & 2 deletions tests/test_association_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion tests/test_i18n.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit f94ff1b

Please sign in to comment.