| name | testing |
|---|---|
| description | Use for pytest setup, test layout, config.py credentials, and hygiene in contentstack-python. |
- Adding or changing tests under
tests/. - Debugging test failures or understanding how credentials are loaded.
- Improving test coverage for a new feature.
| Goal | Command |
|---|---|
| Full test tree | pytest tests/ |
| Single file | pytest tests/test_stack.py |
| With coverage | pytest --cov=contentstack tests/ |
- Root
config.py:HOST,APIKEY,DELIVERYTOKEN,ENVIRONMENT, optionalPREVIEW_TOKEN, content UIDs for specific suites. - Use a local
config.pyor sanitized values; never commit live secrets.
- Tests subclass
unittest.TestCase;tests/pytest.iniapplies warning filters.
| Area | Test files |
|---|---|
| Stack / region | tests/test_stack.py |
| Queries | tests/test_query.py, tests/test_basequery.py |
| Entries / assets | tests/test_entry.py, tests/test_assets.py |
| Taxonomy / global fields / live preview | tests/test_taxonomies.py, tests/test_global_fields.py, tests/test_live_preview.py |
| Early access | tests/test_early_find.py, tests/test_early_fetch.py |
- No committed
pytest.mark.skipwithout reason; avoid@unittest.skipunless environment is genuinely unavailable in CI. - Do not commit real API keys, delivery tokens, or preview tokens.