During my „side-project” I noticed that Gherkin style is great not only for describing behaviour of software. It’s also great for describing any kind of behaviour 🤖

Let’s make fun of my consistency of posting Python stuff here on mastodon:

Given I have an idea for new Python-related toot
And I don't write it down
When I want to write the toot
Then I don't remember what was the idea

Note that this also enables possibilities to "debug" and "explore" that behaviour further.

#DailyPythonista

#TIL in Python, combination of `cache` and `staticmethod` decorators might cause bug in some cases.

It is caused by the fact that `cache` overrides `staticmethod` which no longer is a static method. Hence, it fails when called from class instance because it sees `self` as an unexpected argument - and TypeError is thrown.

See thiss StackOverflow thread for further reference.
https://stackoverflow.com/questions/76403155/does-it-make-sense-to-decorate-a-staticmethod-with-an-lru-cache/76403292#76403292

#DailyPythonista #Python #programming

Meanwhile, in #RobotFramework universe, a new tool emerges that allows for setting up test dependencies.

So, for example if test X fails, then test Y does not make sense, hence is not executed.

It might be actually useful in many end-to-end scenarios, where the rule of keeping tests independent causes either a lot of repetition of costly operations.

#Python #DailyPythonista #TestAutomation
https://pypi.org/project/robotframework-dependencysolver/

Client Challenge

If you ever ask why it’s worth updating #Python dependencies from time to time, #Pydantic serves as a nice example with the performance boost introduced. I actually could see it, given the complexity of models I deal with on a daily basis.

> Recent memory usage optimizations are most relevant for projects with lots of models, particularly those with nested/reused models. In these cases, you can expect a 2-5x reduction in memory usage.

#DailyPythonista
https://pydantic.dev/articles/pydantic-v2-11-release

Pydantic v2.11 | Pydantic

Pydantic v2.11 release highlights

#TIL if you have to deal with lengthy tests in #PyTest, you can split them to sub-tests.

There's a library `pytest-subtests` specifically for that. It basically introduces `subTest` functionality from `unittest` built-in to PyTest, so it is becomes possible to neatly structure complicated tests.

Especially useful for end-to-end-like tests that have to perform a bunch of operations in a sequence and validate output of each. 🐍

#DailyPythonista #Python #Programming
https://pypi.org/project/pytest-subtests/

pytest-subtests

unittest subTest() support and subtests fixture

PyPI

Ever heard of #frupidity? Hopefully you've never worked in one (but chances are, you have).

> Enter frupidity, or stupid frugality – the obsessive drive to save money in ways that ultimately cost far more in lost productivity, morale, and sanity. It’s the engineering equivalent of “optimizing” a car by removing the brakes to improve gas mileage.

Great read from @selix 👌

https://selix.net/notes/dont-be-frupid
#DailyPythonista

Don't be Frupid

Frupidity is stupid frugality that wrecks engineering teams. Misguided cost-cutting kills productivity, morale, and innovation. You can fight it.

Looks like now you can become "Robot Framework Certified Professional" for €240 🤖

Even if you don't plan to do the whole examination, it's worth taking a look on the syllabus. For me, it looks like a singular document that I would point to whenever asked by someone about "how to learn Robot Framework".

What do you think about such certification? Is it worth the price?

#RobotFramework #Python #Programming #DailyPythonista #certification
https://cert.robotframework.org/certificates/RFCP

Robot Framework Certified Professional (RFCP) | Certification Details & Benefits

Explore the RFCP certification details including exam structure, pricing, target audience, and business outcomes. Elevate your test automation expertise today.

What got me thinking today at work was how to test one massive set of transactions in #Django with support of #PyTest. One test is like 400 lines of code (multiple objects created and outputs created, “by design”).

Sounds like a neat challenge to tackle Monday morning.

Maybe anyone here tackled something like this? Tried splitting big test into smaller chunks and testing steps but with shared scope of variables and test database state?

#DailyPythonista #Python #programming

@hynek thanks for the article on subclassing!

You had nice prediction - it was on my reading list for many months. Took me 1 big coffee to finish, but was worth it. I feel like I should take one more look to protocols in Python (which I used to use but different project and forgot the thing a bit) 🐍

Definitely one of the best takes on the topic of inheritance in Python.

https://hynek.me/articles/python-subclassing-redux/

#DailyPythonista #python #programming

Subclassing in Python Redux

The conflict between subclassing and composition is as old as object-oriented programming. The latest crop of languages like Go or Rust prove that you don’t need subclassing to successfully write code. But what’s a pragmatic approach to subclassing in Python, specifically?

Hynek Schlawack

If you use #macOS and have a problem with #Docker not working, take a look on this incident update:
https://www.docker.com/blog/incident-update-docker-desktop-for-mac/

#DailyPythonista

Incident Update: Docker Desktop for Mac | Docker

Docker has identified and provided a temporary workaround for an issue preventing Docker Desktop from starting on some macOS systems, with a permanent fix currently in development.

Docker