HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
pytest-dev
pytest
Python2015–2025
pytest-dev / pytest

pytest

The pytest framework makes it easy to write small tests, yet scales to support complex functional testing

9Distinct people
9Mentions
0Explicit recommenders
14.7KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

The pytest framework makes it easy to write small tests, yet scales to support complex functional testing

GitHub

Where it is used

No documented product use has been verified yet.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 11:56:56 AM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year9 dated mentions

Observed mentions: 2015-06-16 06:20:07 UTC to 2025-02-04 21:31:20 UTC.

01232015-01-01 00:00:00 UTC to 2016-01-01 00:00:00 UTC (exclusive): 1 mentions; 1 submissions, 0 comments20152016-01-01 00:00:00 UTC to 2017-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2017-01-01 00:00:00 UTC to 2018-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2018-01-01 00:00:00 UTC to 2019-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2019-01-01 00:00:00 UTC to 2020-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 3 mentions; 0 submissions, 3 comments20202021-01-01 00:00:00 UTC to 2022-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2023-01-01 00:00:00 UTC to 2024-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2024-01-01 00:00:00 UTC to 2025-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments2025-01-01 00:00:00 UTC to 2026-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2025

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20152015-01-01 00:00:00 UTC2016-01-01 00:00:00 UTC110
20162016-01-01 00:00:00 UTC2017-01-01 00:00:00 UTC000
20172017-01-01 00:00:00 UTC2018-01-01 00:00:00 UTC000
20182018-01-01 00:00:00 UTC2019-01-01 00:00:00 UTC000
20192019-01-01 00:00:00 UTC2020-01-01 00:00:00 UTC000
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC303
20212021-01-01 00:00:00 UTC2022-01-01 00:00:00 UTC000
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC101
20232023-01-01 00:00:00 UTC2024-01-01 00:00:00 UTC101
20242024-01-01 00:00:00 UTC2025-01-01 00:00:00 UTC202
20252025-01-01 00:00:00 UTC2026-01-01 00:00:00 UTC101

What Hacker News says

9 sources
In python everything is an object. I'm sure there are minor exceptions or arguable cases but that's also the case with Ruby. Most infamously with Proc. Classes are objects in python, usually instances of class called type or a subclass of type(usefulfor controlling class creation), this is called the metaclass. A constructor call MyObject() is basically just the __call__ method of the metaclass. Modules are also objects usually of type types.ModuleClass or a subclass although really you can stick any object in sys.modules dictionary and have it act like a module and import it. Sure it doesn't use messages instead attributes whether field or methods both go through the same lookup method __getattribute__ which goes up the class inheritance chain in an OO manner. There's also __getattr__ for more method_missing like access instead of overr
Read the rest
iding every object attribute access. A function or lambda is an instance of function class although I don't think you can't modify or override the function class I think you can hook it to log it. You can also do all sorts of stuff by hooking module import and rewriting the ast. Or more easily you can decorate/wrap the functions in another function object. It's true that you can't modify c based classes but you can do a lot of magic in python, people usually just don't because unnecessary magic is frowned on. But sometimes it's useful like the way pytest rewrites assert a==[1,2,3] to print a nice error message with both variables https://github.com/pytest-dev/pytest/blob/main/src/_pytest/a...
In Ruby “Thread Contention” Is Simply GVL Queuing
In Python, some of the stated use cases, like extracting coverage, extracting the call graph, etc, you can get via tracing already (sys.settrace, https://docs.python.org/3/library/sys.html#sys.settrace). And I would argue, the other stated use cases are maybe interesting to play around with, but nothing you really would want in production (I suppose). Some of the other use cases, you can also achieve by module import hooks and rewriting the AST. (E.g. see how PyTest rewrites the assertion AST to produce nice error messages: https://github.com/pytest-dev/pytest/blob/main/src/_pytest/a...)
In Python Meta Circular Interpreter (2019)
Is there a reason you need specialized assertions over something like Python's generic assert? >>> big = 2; small = 3 >>> assert big >= small, "big is smaller than small" Traceback (most recent call last): File "<stdin>", line 1, in <module> AssertionError: big is smaller than small In pytest, assertions are rewritten[1] to return something more useful like: def test(): big = 2 small = 3 > assert big > small E assert 2 > 3 test/test_dumb.py:4: AssertionError ========== short test summary info ========== FAILED test/test_dumb.py::test - assert 2 > 3 1: https://github.com/pytest-dev/pytest/blob/f373974707f57a0b28...
In Local Variables as Accidental Breadcrumbs for Faster Debugging
that doesn't make much sense and there are necessary uses for eval() /exec(), mostly for dynamic creation of code: For example here's Python dataclasses in the standard library using exec() to create the `__init__` and other methods that go on your dataclass: https://github.com/python/cpython/blob/main/Lib/dataclasses.... Here's Pydantic using it for a jupyter notebook check: https://github.com/pydantic/pydantic/blob/594effa279668bd955... here's Pytest using it to rewrite modules so that functions like assert etc. are instrumented by pytest: https://github.com/pytest-dev/pytest/blob/eca93db05b6c5ec101... Here's the decorator module using it (as is the only way to do this in Python) to create a signature matching decorator for an arbitrary function: https://github.com/micheles/decorator/blob/ad013a2c1ad796996... All of these libraries are
Read the rest
completely secure as eval/exec are used with code fragments that are generated by the libraries, not based on untrusted input. eval() /exec() are not running executable files, just Python code, the same way all the rest of the package is already doing.
In Python malware starting to employ anti-debug techniques
py.test has a different way of finding tests. It loads Python files starting with "test_" or ending in "_test.py" then uses reflection, to find functions starting with "test_" or classes starting with "Test", or functions marked with the attribute "__test__" (which is applied by the @nose.tools.istest decorator). See https://github.com/pytest-dev/pytest/blob/d69abff2c7de8bc65b... This mechanism of scanning the AST is a different approach and won't find the same set of tests. Scanning the AST can be useful and things like https://macropy3.readthedocs.io/en/latest/ are awesome though!
In Analyzing Python Code with Python
I feel very uncomfortable whenever I read a code-of-conduct, including the PyTest one: https://github.com/pytest-dev/pytest/blob/master/CODE_OF_CON... I don’t think there’s anything wrong at all with the spirit of such documents, but they seem to normalize a world where bad behavior is regulated by well-intentioned ad hoc legalese. In the good old days, one would receive on the spot practical training on how to behave by ones parents, friends, older siblings, teachers etc. I suspect my revulsion at reading codes of conducts is part of me being in denial that there are so many more people in the world now, on the internet, who were raised by the social / etiquette equivalent of animals.
In Contributors Leaving Pytest

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.