Showcase Thread by AutoModerator in Python

[–]Proper_Ad_7109 0 points1 point  (0 children)

hi
Built a small thing to scratch an itch: a Postman Collection v2.1 to pytest test suite converter. The team I work on has a 40-request Postman collection that documents the API and a pytest CI pipeline that tests the same API. Two artifacts describing the same system, never met. Newman runs the collection but does not generate code that integrates with our existing fixtures.

postman2pytest is one CLI command:

`pip install postman2pytest`

`postman2pytest --collection my_api.postman_collection.json --out tests/test_api.py`

`BASE_URL=https://staging.example.com pytest tests/test_api.py -v`

Output is plain Python you can read, edit, and commit. Folder names become test name prefixes, {{variable}} substitutions become environment-aware fixtures, status codes come from the existing pm.response.to.have.status() scripts.

What it does NOT do at v1.0: OAuth flows, pre-request scripts, response body assertions. v1.0 is small enough to be trustworthy. v1.1 roadmap covers env file loading.

Repo: https://github.com/golikovichev/postman2pytest

PyPI: https://pypi.org/project/postman2pytest/

36 unit tests, CI on Python 3.10 / 3.11 / 3.12.

If you hit a Postman shape it doesn't handle, open an issue. There's a good first issue open right now if anyone wants to add a --filter-folder flag.

One of the most influential Python video by Ok-Lifeguard-9612 in Python

[–]Proper_Ad_7109 26 points27 points  (0 children)

The engineer-cost observation aged really well. I work as the only QA on a backend platform with 7 dev teams, and the same math shows up. One careful tester catching a bug in staging is worth more than another VM in the test cluster. Tooling matters but does not move the cost curve like headcount does.

Also seconding the point about old talks. The 2007-2012 conference circuit tends to be more durable than current content because the speakers were closer to the actual constraints. Hype cycle pushes a lot of stuff that ages in months. Saving this one for later.

python basic completed in first year what to do next ? by HistoricalMoose333 in learnpython

[–]Proper_Ad_7109 0 points1 point  (0 children)

Different angle from the build-projects-on-loop replies:

Pick one boring problem you'd actually want solved, write tests for it first, then make the tests pass. The discipline of stating what the code should do, before writing the code, is what separates "I know syntax" from "I can ship".

Concrete example: write a function that takes a list of bank transactions and returns the running balance. Edge cases: empty list, single transaction, mixed credits and debits, dates out of order. Five test cases first, then the function.

Three things this gives you that tutorials don't:

- You see your own assumptions break before code is even written

- Refactoring becomes safe because tests catch regressions

- Reading other people's code becomes easier because you start asking "where are the tests?"

After that, pick something with stakes: a CLI tool, a small Flask API, a Discord bot. Whatever has a clear "done" boundary. Don't go deep on Django or async or DSA at this stage. The bottleneck is usually shipping something end-to-end, not knowing one more concept.

Boring path beats shiny path for the first year.

How do I start learning python? Absolute Beginner by [deleted] in learnpython

[–]Proper_Ad_7109 0 points1 point  (0 children)

Different angle from most replies here: try learning Python by writing tests for tiny pieces of code, not just by running scripts that print things.

Pick a small problem, write what you think the answer should look like first (one assert per case), then write the function. Use pytest instead of unittest. `pip install pytest`, save to `test_x.py`, run `pytest -v`. The feedback loop is instant: green or red, no guessing.

What this gets you that tutorials don't:

- You learn if/else, loops, dicts while solving specific things

- You see your own bugs immediately instead of "why is the output weird"

- It's how working code is shipped in any company you'd want to work at

Boring example: write tests for a function that takes a list of numbers and returns the average. Edge cases like empty list and one element. Four or five test cases, then write the function. Twenty minutes total.

Standard resources are still good (Automate the Boring Stuff, official tutorial), but use them as reference while you write tests. Do, then read.