Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PLAT-138 Follow Up to #1114 #1116

Merged
merged 16 commits into from
Dec 5, 2023
Merged

PLAT-138 Follow Up to #1114 #1116

merged 16 commits into from
Dec 5, 2023

Conversation

ethho
Copy link
Contributor

@ethho ethho commented Dec 2, 2023

I made some edits to the tests that were recently migrated to pytest in #1114. Minor edits so that we're closer to pytest standard practice. This includes decreasing the scope of the fixtures that return schemas.

This includes the changes from #1115 so please merge that one before this one.

@ethho ethho requested a review from A-Baji December 2, 2023 05:00
tests/schema.py Outdated


LOCALS_ANY = {k: v for k, v in locals().items() if inspect.isclass(v)}
__all__ = list(LOCALS_ANY.keys())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
__all__ = list(LOCALS_ANY.keys())
__all__ = list(LOCALS_ANY)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review. I'll make these fixes in another WIP PR to datajoint:dev-tests branch.

@@ -135,3 +133,6 @@ class GlobalSynapse(dj.Manual):
-> Cell.proj(pre_slice="slice", pre_cell="cell")
-> Cell.proj(post_slice="slice", post_cell="cell")
"""

LOCALS_ADVANCED = {k: v for k, v in locals().items() if inspect.isclass(v)}
__all__ = list(LOCALS_ADVANCED.keys())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
__all__ = list(LOCALS_ADVANCED.keys())
__all__ = list(LOCALS_ADVANCED)



LOCALS_SIMPLE = {k: v for k, v in locals().items() if inspect.isclass(v)}
__all__ = list(LOCALS_SIMPLE.keys())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
__all__ = list(LOCALS_SIMPLE.keys())
__all__ = list(LOCALS_SIMPLE)

Comment on lines 38 to 60
@pytest.fixture
def schema_ad(
schema_name_custom_datatype, connection_test, adapted_graph_instance,
enable_adapted_types, enable_filepath_feature
):
stores_config = {
"repo-s3": dict(
S3_CONN_INFO, protocol="s3", location="adapted/repo", stage=tempfile.mkdtemp()
)
}
dj.config["stores"] = stores_config
layout_to_filepath = schema_adapted.LayoutToFilepath()
context = {
**schema_adapted.LOCALS_ADAPTED,
'graph': adapted_graph_instance,
'layout_to_filepath': layout_to_filepath,
}
schema = dj.schema(schema_name_custom_datatype, context=context, connection=connection_test)
graph = adapted_graph_instance
schema(schema_adapted.Connectivity)
schema(schema_adapted.Layout)
yield schema
schema.drop()
Copy link
Collaborator

@A-Baji A-Baji Dec 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason not to set up schema_adapted in conftest.py?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The adapted schema schema_ad is only used in this module, so I kept it as a module-specific fixture.

@ethho
Copy link
Contributor Author

ethho commented Dec 5, 2023

CI is failing black tests --check. This is fixed in a downstream PR #1117

@A-Baji A-Baji merged commit 1814f9b into datajoint:dev-tests Dec 5, 2023
ethho added a commit to ethho/datajoint-python that referenced this pull request Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants