Skip to content

fix: migrate example plugin test from cmempy to cmem-client - #53

Open
msaipraneeth wants to merge 2 commits into
developfrom
fix/example-test-cmem-client-migration
Open

fix: migrate example plugin test from cmempy to cmem-client#53
msaipraneeth wants to merge 2 commits into
developfrom
fix/example-test-cmem-client-migration

Conversation

@msaipraneeth

Copy link
Copy Markdown
Contributor

Summary

  • The generated example test still imported cmem.cmempy directly. cmem-plugin-base is dropping its cmem-cmempy dependency in favor of cmem-client, and this template never declared cmem-cmempy itself, so newly generated plugin projects (and this template's own CI, which generates and checks a project) would break with ModuleNotFoundError once the new cmem-plugin-base ships.
  • Migrates the example fixture/test to cmem-client directly (added as a dev dependency), matching the pattern cmem-plugin-base's own test suite now uses, and makes the fixture idempotent (delete-then-create) so a crashed prior run doesn't break the next one.
  • Fixes a streaming-response bug caught while verifying: client.datasets.get_file_resource() returns a streaming httpx.Response, so .text needs .read() first.

Test plan

  • Generated a project from this branch via copier copy --defaults . plugin_dir using the plugin.yml test case
  • poetry install, mypy, ruff check, ruff format --check all clean on the generated project
  • pytest passed against a real CMEM instance (plugin-testing.eccenca.dev), including both needs_cmem-gated integration tests
  • Re-ran pytest a second consecutive time to confirm the delete-then-create fixture is idempotent against leftover state

The generated example test imported cmem.cmempy directly. cmem-plugin-base
is dropping its cmem-cmempy dependency in favor of cmem-client, and this
template never declared cmem-cmempy itself, so every newly generated plugin
project (and this template's own CI, which generates and checks a project)
would break with ModuleNotFoundError once the new cmem-plugin-base ships.
Switches the example fixture and test to cmem-client directly, matching
the pattern cmem-plugin-base's own test suite now uses, and makes the test
project idempotent (delete-then-create) so a crashed prior run doesn't
break the next one.
client.datasets.get_file_resource() returns a streaming httpx.Response;
.text can't be accessed before .read(), same as ProjectFile.read_stream
handles it in cmem-plugin-base. Caught by generating a project from this
template and running its tests against a real CMEM instance.
@github-actions

Copy link
Copy Markdown

Coverage

Coverage Report
File Stmts Miss Cover Missing
init.py 0 0 100%
example_transform.py 28 0 100%
example_workflow.py 36 2 94% 53 56
TOTAL 64 2 97%  

Tests Skipped Failures Errors Time
4 0 💤 0 ❌ 0 🔥 7.520 ⏱

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant