testing

Use for pytest setup, test layout, config.py credentials, and hygiene in contentstack-python.

npx skills add https://github.com/contentstack/contentstack-python --skill testing

Testing – Contentstack Python CDA SDK

When to use

  • Adding or changing tests under tests/.
  • Debugging test failures or understanding how credentials are loaded.
  • Improving test coverage for a new feature.

Instructions

Commands

GoalCommand
Full test treepytest tests/
Single filepytest tests/test_stack.py
With coveragepytest --cov=contentstack tests/

Environment

  • Root config.py: HOST, APIKEY, DELIVERYTOKEN, ENVIRONMENT, optional PREVIEW_TOKEN, content UIDs for specific suites.
  • Use a local config.py or sanitized values; never commit live secrets.

Conventions

  • Tests subclass unittest.TestCase; tests/pytest.ini applies warning filters.

Scope by module

AreaTest files
Stack / regiontests/test_stack.py
Queriestests/test_query.py, tests/test_basequery.py
Entries / assetstests/test_entry.py, tests/test_assets.py
Taxonomy / global fields / live previewtests/test_taxonomies.py, tests/test_global_fields.py, tests/test_live_preview.py
Early accesstests/test_early_find.py, tests/test_early_fetch.py

Hygiene

  • No committed pytest.mark.skip without reason; avoid @unittest.skip unless environment is genuinely unavailable in CI.
  • Do not commit real API keys, delivery tokens, or preview tokens.

Больше skills от contentstack

brand-kit-assistant
contentstack
Advise users on Contentstack Brand Kit concepts, setup, governance, and on-brand AI generation. Route API-specific tasks to the right Brand Kit capability or…
official
cms-assets
contentstack
Консультировать разработчиков по организации, доставке и трансформации ассетов в Contentstack. Охватывать структуру папок, трансформации Image Delivery API, публикацию…
official
cms-branches-aliases
contentstack
Консультировать разработчиков по использованию веток Contentstack для изолированной разработки контента и алиасов для развертывания контента без простоев. Описать стратегию ветвления,…
official
cms-data-modeling-best-practices
contentstack
Помогите разработчикам моделировать контент в Contentstack, используя простейшую переиспользуемую структуру. Навык объясняет, когда использовать типы контента, ссылки, глобальные…
official
cms-entries
contentstack
Advise developers on querying, localizing, versioning, publishing, and structuring Contentstack entries for efficient delivery. Focus on CDA usage, reference…
official
cms-environments-publishing
contentstack
Advise developers on configuring environments, publishing content, using delivery and preview tokens, leveraging the Sync API, and understanding CDN and…
official
cms-live-preview-visual-builder-support-assistant
contentstack
Diagnose and guide Contentstack Live Preview and Visual Builder implementations. Trace preview context, identify the broken contract, and recommend the…
official
cms-localization
contentstack
Advise developers on Contentstack localization: language setup, fallback chains, localized vs unlocalized entries, non-localizable fields, and multi-locale…
official