From 9fd2c5220dcd1a27fa34d8911652a7f9b5f4760e Mon Sep 17 00:00:00 2001
From: Mitchell Pleune <mpleune@ltu.edu>
Date: Thu, 10 Apr 2025 13:06:33 -0400
Subject: [PATCH] fix: test_sets_default_sess_options fails if compiling with
 globally enabled cuda (#17516)

Coming from nixos, this test fails when cuda is enabled. https://github.com/NixOS/nixpkgs/pull/382896

Solution as proposed by @mertalev
---
 machine-learning/test_main.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/machine-learning/test_main.py b/machine-learning/test_main.py
index a19ec65c5f..eeafd01062 100644
--- a/machine-learning/test_main.py
+++ b/machine-learning/test_main.py
@@ -278,8 +278,8 @@ class TestOrtSession:
 
         assert session.provider_options == []
 
-    def test_sets_default_sess_options(self) -> None:
-        session = OrtSession("ViT-B-32__openai")
+    def test_sets_default_sess_options_if_cpu(self) -> None:
+        session = OrtSession("ViT-B-32__openai", providers=["CPUExecutionProvider"])
 
         assert session.sess_options.execution_mode == ort.ExecutionMode.ORT_SEQUENTIAL
         assert session.sess_options.inter_op_num_threads == 1