Order-dependent test failures: custom_globals.lp mutates global Python evaluation environment (_shared_environment) and leaks across tests

Aperta
#188 0 commenti 0 reazioni 2 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@VictosVertex ci sta già lavorando.

Dal 16/3/2026.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

Running the full test suite via nox -s test can produce order-dependent failures in tests that use Python operators like python("math.pow"). The root cause is that custom_globals.lp deliberately modifies the global/shared Python evaluation environment in constraint_handler.evaluator (specifically _shared_environment) and that change persists for the remainder of the pytest process.

Because the Python helper code used by @pythonEvalExpr / Python operators reads globals from constraint_handler.evaluator._shared_environment, mutating it in one test affects unrelated subsequent tests. This makes the suite sensitive to test order and can cause flaky failures.

Steps to reproduce

Run the full suite:
nox -s test
Observe that after custom_globals runs, a later test that relies on math being present in the Python environment may fail (e.g., a fixture using operation(python("math.pow"), ...)).

Related to #72

Lingua principale
Python
Stelle
4
Fork
0
Merge medio
2g 9h
PR unite (30g)
19

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 potassco/constraint-handler

Tutte le issue di potassco/constraint-handler

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.