med-mastodon.com is one of the many independent Mastodon servers you can use to participate in the fediverse.
Medical community on Mastodon

Administered by:

Server stats:

359
active users

#pytest

4 posts4 participants0 posts today

New on blog: "EPYTEST_PLUGINS and other goodies now in #Gentoo"

"""
If you are following the gentoo-dev mailing list, you may have noticed that there’s been a fair number of patches sent for the #Python eclasses recently. Most of them have been centered on #pytest support. Long story short, I’ve came up with what I believed to be a reasonably good design, and decided it’s time to stop manually repeating all the good practices in every ebuild separately.

In this post, I am going to shortly summarize all the recently added options. As always, they are all also documented in the Gentoo Python Guide.
"""

blogs.gentoo.org/mgorny/2025/0

Michał Górny · EPYTEST_PLUGINS and other goodies now in GentooIf you are following the gentoo-dev mailing list, you may have noticed that there’s been a fair number of patches sent for the Python eclasses recently. Most of them have been centered on pyt…
Replied to John-Mark Gurney

@encthenet @rachelplusplus Dunno if you've considered this, or would consider it, but pytest has a plugin, pytest-fakefs (github.com/pytest-dev/pyfakefs), that implements an in-memory filesystem complete with file objects that you can use to test file handling code without having to put things on disk. IMO the plugin ecosystem for handling things like this is one of pytest's biggest advantages over unittest.

Or if you prefer, pytest also has built-in functionality that makes working with temporary files pretty easy.

Provides a fake file system that mocks the Python file system modules. - pytest-dev/pyfakefs
GitHubGitHub - pytest-dev/pyfakefs: Provides a fake file system that mocks the Python file system modules.Provides a fake file system that mocks the Python file system modules. - pytest-dev/pyfakefs

Idle thought apropos of nothing specific:

The very same folks telling me BOTH that I MUST use pytest, and that Django MUST have its JSON API story built-in continues to be ironic.

I'd (probably) at least open with the thought that testing is easily as central to a language as JSON APIs are to a web framework.

I don't see a movement to merge pytest to the stdlib.

A tak poza tym, to wysłałem parę łatek, by ulepszyć funkcję epytest w #Gentoo.

Wymuszają krótkie podsumowania, załączają tworzenie plików junit .xml, żeby ułatwić maszynowe przetwarzanie wyników, i — co najważniejsze — dodają zmienną EPYTEST_PLUGINS, żeby podawać, które wtyczki mają być załadowane. Będziemy dążyć do tego, by całkiem odejść od domyślnego automatycznego ładowania wtyczek.

archives.gentoo.org/gentoo-dev

archives.gentoo.org[gentoo-dev] [PATCH 0/5] python-utils-r1.eclass: epytest improvements

Paczki Pythona:

"A pamiętacie tę całkowicie przypadkową wtyczkę PyTesta, która nie jest rozwijana od 2018 roku, i którą musieliście dodać do #Gentoo, bo postanowiliśmy jej używać bez jakiegokolwiek powodu? No cóż, właśnie przestaliśmy. A tak przy okazji — właśnie udało nam się znaleźć kolejną wtyczkę, która po raz trzeci wynajduje na nowo obsługę niestabilnych testów. Miłej zabawy!"

(Szczęśliwie, jest dostatecznie kompatybilna z pytest-rerunfailures, żebym mógł ją zignorować.)

Czy to nie super, kiedy okazuje się, że padający test w #Twisted (który najpewniej jest objawem prawdziwego błędu w kodzie) występuje tylko, jeżeli dodatkowo zainstalujemy #Trio, #PyTest oraz Py? Znaczy się, o ile dobrze to rozumiem, to Twisted importuje Trio, a błąd wynika z automatycznego łańcucha opcjalnych zależności Trio → PyTest → Py.

github.com/twisted/twisted/iss

GitHub`builtins.RuntimeError: dictionary changed size during iteration` in `twisted.python.rebuild.rebuild()` with parallel testing · Issue #12458 · twisted/twistedBy mgorny