`assert_trace` does not work correctly with functions that use the same decorator
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- python
- Ambito
- testing-qa
Direzione di ricerca
Inizia dall’implementazione di assert_trace del plugin pytest e riproduci il comportamento con l’esempio del decoratore nell’issue. Aggiungi o aggiorna un test di regressione che mostri che chiamare func_two non soddisfa un’asserzione per func_one; il lavoro è completato quando il test mostrato fallisce come previsto, mentre le asserzioni per la funzione corretta continuano a passare.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Bug report
What's wrong
Our assert_trace from pytest plugin doesn't work correctly when two or more different functions are using the same decorator, it not considers that those functions are different! See the example below:
def test_two_functios_using_same_decorator(returns: ReturnsAsserts):
def decorator(func):
def decorated(*args, **kwargs):
return func(*args, **kwargs)
return decorated
@decorator
def func_one():
return Success(42)
@decorator
def func_two():
return Success(42)
with returns.assert_trace(Success, func_one):
func_two()
That test should fail because we want to assert the Success creation inside func_one, but I'm calling func_two and the test is passing!
How is that should be
Our pytest plugin should consider that those functions are different!
System information
pythonversion: 3.9returnsversion: 0.16.0
- Lingua principale
- Python
- Stelle
- 4.4k
- Fork
- 154
- Merge medio
- 3h 5m
- PR unite (30g)
- 22
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di dry-python/returns
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
dry-python/returns#2394 · 1 reazione ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 52/100
dry-python/returns#2365 ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
dry-python/returns#2355 · 1 commento ·
-
bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
dry-python/returns#2295 · 4 commenti · 1 reazione ·
-
bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
dry-python/returns#2253 · 2 commenti ·
Tutte le issue di dry-python/returns
Issue simili
-
essnmx good first issue
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 95/100
-
[Feature] 奇物选择添加优先级 Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
syfoud/Simulated_Scepter#174 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
Giskard-AI/giskard-oss#2840 · 1 commento ·
-
A claim comment carrying the issue number is silently declined while the workflow reports success Apertaarea: repo bug perceived difficulty: 2
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
yeti-platform/yeti#1380 ·