Releases: golikovichev/postman2pytest
postman2pytest 1.2.0
Added
- Test-script assertion translation: Postman pm.test(...) scripts are now translated into pytest assert statements: response time, header presence, and top-level JSON field equality (string / number / boolean). Patterns outside this subset are skipped rather than mistranslated, so a generated test never carries a broken assert.
- Form body support: urlencoded and formdata text fields render as a data={...} argument on the request.
- Status extraction also recognises the pm.response.code === 201 idiom in test scripts.
Full changelog: see CHANGELOG.md
v1.0.2 - packaging fix
Packaging fix release.
The hatch build config now uses a tool.hatch.build.targets.wheel.force-include directive that places main.py at the top level of the wheel. This is the module the postman2pytest console script entry point references.
After pip install postman2pytest, postman2pytest --help and postman2pytest --collection ... --out ... work as documented.
Also folded in from v1.0.1: ASCII-safe test names for non-Latin folder names (Cyrillic, Chinese, Arabic, accented Latin) plus numeric suffix disambiguation when slugs collide. Closes #3.
Install
pip install --upgrade postman2pytest
Changelog
See CHANGELOG.md.
v1.0.1: Non-ASCII folder name fix
Fixed
- Non-ASCII folder names (Cyrillic, Chinese, Arabic, accented Latin) no longer produce empty test name prefixes that silently collide. Folder slugs are now transliterated via
unidecodesoЗаказыbecomeszakazyin the generated function name. Closes #3. - Test names that would still collide after slugification (for example several requests in the same folder sharing an HTTP method and missing the Postman
namefield) now receive a_1/_2/_Nsuffix so every parsed request maps to a unique pytest function. The parser emits a warning per affected base name.
Added
unidecode>=1.3,<2runtime dependency for ASCII transliteration.- 12 unit tests covering Cyrillic, Chinese, accented Latin, empty input, punctuation-only input, no-collision passthrough, and the exact issue #3 reproduction.
v1.0.0 - Initial Release
What's new
First public release of postman2pytest.
Convert a Postman Collection v2.1 JSON file into a ready-to-run pytest test suite in one command:
pip install postman2pytest
postman2pytest --collection my_api.json --out tests/test_api.py
BASE_URL=https://api.example.com pytest tests/test_api.py -vFeatures
- Parses Postman Collection v2.1 (v2.0 accepted with a warning)
- Nested folders flattened with folder prefix in test name
- Postman variables (
{{base_url}},{{token}}) resolve toos.environ.get()in generated code - Status codes extracted from
pm.response.to.have.status(N)test scripts - Disabled headers excluded automatically
- Malformed items skipped with a warning. Rest of collection still generated
- 36 unit tests, CI on Python 3.10 / 3.11 / 3.12
See CHANGELOG.md for full details.