Skip to content

Commit d180f2b

Browse files
authored
fix: make CLI monitor tests to be able to run on a Windows environment (#1459)
1 parent 24ddb59 commit d180f2b

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

‎tests/cli/test_cli_main.py‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Tests for the CodeCarbon CLI main function."""
22

33
import os
4+
import sys
45
from types import SimpleNamespace
56

67
import pytest
@@ -116,7 +117,8 @@ def test_monitor_run_and_monitor(monkeypatch):
116117

117118
# Test with a simple command
118119
result = runner.invoke(
119-
cli_main.codecarbon, ["monitor", "--no-api", "--", "echo", "Hello, World!"]
120+
cli_main.codecarbon,
121+
["monitor", "--no-api", "--", sys.executable, "-c", "print('Hello, World!')"],
120122
)
121123
assert result.exit_code == 0
122124
assert "Hello, World!" in result.output
@@ -150,8 +152,8 @@ def stop(self):
150152
"test-project",
151153
"--no-api",
152154
"--",
153-
"echo",
154-
"test",
155+
sys.executable,
156+
"--version",
155157
],
156158
)
157159

0 commit comments

Comments
 (0)