exceptionfactory commented on code in PR #8510:
URL: https://github.com/apache/nifi/pull/8510#discussion_r1526301698


##########
nifi-nar-bundles/nifi-py4j-bundle/nifi-py4j-bridge/src/test/java/org/apache/nifi/py4j/PythonProcessTest.java:
##########
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.py4j;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.mockito.Mockito.when;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.nifi.python.ControllerServiceTypeLookup;
+import org.apache.nifi.python.PythonProcessConfig;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.junit.jupiter.api.io.CleanupMode;
+import org.junit.jupiter.api.io.TempDir;
+import org.mockito.Mock;
+import org.mockito.junit.jupiter.MockitoExtension;
+
+@ExtendWith(MockitoExtension.class)
+class PythonProcessTest {
+
+    private PythonProcess pythonProcess;
+
+    @TempDir(cleanup = CleanupMode.ON_SUCCESS)
+    private File virtualEnvHome;
+
+    @Mock
+    private PythonProcessConfig pythonProcessConfig;
+
+    @Mock
+    private ControllerServiceTypeLookup controllerServiceTypeLookup;
+
+    @BeforeEach
+    public void setUp() {
+        this.pythonProcess = new PythonProcess(this.pythonProcessConfig, 
this.controllerServiceTypeLookup, virtualEnvHome, "Controller", "Controller");
+    }
+    @Test
+    void testResolvePythonCommandWindows() throws IOException {
+        File scriptsDir = new File(virtualEnvHome, "Scripts");
+        scriptsDir.mkdir();
+        when(pythonProcessConfig.getPythonCommand()).thenReturn("python");
+        String result = this.pythonProcess.resolvePythonCommand();
+        assertEquals(this.virtualEnvHome.getAbsolutePath() + File.separator + 
"Scripts" + File.separator + "python", result);
+    }
+
+    @Test
+    void testResolvePythonCommandUnix() throws IOException {

Review Comment:
   No, as mentioned for Windows, the code checks for a directory, it is not 
dependent on the runtime platform for that reason.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to