Tracing temp directories are never cleaned up when keywords are called from Python outside a Robot Framework run

Aperta Adatta ai principianti
#5,153 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
78/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Tranquilla
Stack tecnologico
playwright, python
Ambito
testing-qa

Direzione di ricerca

Inizia in Browser/keywords/playwright_state.py intorno alla riga 911 e segui close_context() fino al flush della relativa trace. Confronta questo percorso con la pulizia in Browser/browser.py:838-848, che viene eseguita solo dal listener hook _start_suite. Riproduci l’esempio solo Python e conferma che la chiusura di un contesto tracciato non lasci alcuna directory sotto browser/traces/temp//.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Tracing writes its working files to browser/traces/temp/<uuid>/ (Browser/keywords/playwright_state.py:911). Those are cleaned up from the _start_suite listener hook (Browser/browser.py:838-848), which only fires during a Robot Framework run. When keywords are called directly from Python the hook never runs, so the temp directories accumulate and are never removed.

Reproduce
from Browser import Browser

browser = Browser()
browser.new_browser("webkit", headless=True)
browser.new_context(tracing=True)
browser.new_page("https://robotframework-browser.org")
browser.close_context()
browser.close_browser("ALL")

Observed afterwards, left in place:

browser/traces/temp/<uuid>/
    <name>.trace
    <name>.network
    resources/*.jpeg

The trace zip itself is produced correctly by close_context(); it is only the temp working directory that is left behind, once per traced context.

Note that with the default outputdir these land inside the installed package rather than the caller's working directory — that part is a separate issue about the relative default outputdir, and it is filed on its own. This report is about the cleanup never happening at all, which remains true even when outputdir is absolute.

Suggested fix

Remove the temp directory when the trace is flushed in close_context(), rather than relying on a listener hook that only exists during a Robot Framework run.

Environment

Browser 20.3.0, Robot Framework 7.4.1, Python 3.14.7, macOS, webkit.

Lingua principale
Python
Stelle
662
Fork
149
Merge medio
6h 13m
PR unite (30g)
121

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di MarketSquare/robotframework-browser

Tutte le issue di MarketSquare/robotframework-browser

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.