Skip to content

Commit 5f694e6

Browse files
committed
test: update test test_node_system_creates_shim
- Replaced the use of `subprocess.Popen` with `shutil.which` to mock the system node path in the activation tests, enhancing the reliability of the test environment. - This change aligns with the ongoing effort to minimize external dependencies and improve test performance.
1 parent fa3fdfb commit 5f694e6

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

tests/test_install_activate.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,14 +131,11 @@ def test_node_system_creates_shim(tmpdir):
131131

132132
# Mock system node path
133133
system_node = '/usr/bin/node'
134-
mock_popen = mock.MagicMock()
135-
mock_popen.communicate.return_value = (
136-
system_node.encode() + b'\n', b'')
137134

138135
with mock.patch.object(
139136
sys, 'argv', ['nodeenv', '--node=system', str(tmpdir)]
140137
):
141-
with mock.patch('subprocess.Popen', return_value=mock_popen):
138+
with mock.patch('shutil.which', return_value=system_node):
142139
opts = nodeenv.parse_args()
143140
nodeenv.install_activate(str(tmpdir), opts)
144141

0 commit comments

Comments
 (0)