martinzink commented on code in PR #1504:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1504#discussion_r1124479095


##########
extensions/python/tests/CMakeLists.txt:
##########
@@ -0,0 +1,79 @@
+#
+# 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.
+#
+
+file(GLOB EXECUTESCRIPT_PYTHON_TESTS 
"TestExecuteScriptProcessorWithPythonScript.cpp" "PythonScriptEngineTests.cpp")
+file(GLOB EXECUTEPYTHONPROCESSOR_UNIT_TESTS "ExecutePythonProcessorTests.cpp" 
"PythonManifestTests.cpp")
+file(GLOB PY_SOURCES  "python/*.cpp")
+include(GenericPython)
+
+SET(EXTENSIONS_TEST_COUNT 0)
+
+FOREACH(testfile ${EXECUTESCRIPT_PYTHON_TESTS})
+    get_filename_component(testfilename "${testfile}" NAME_WE)
+    add_executable("${testfilename}" "${testfile}")
+    target_include_directories(${testfilename} PRIVATE BEFORE 
"${CMAKE_SOURCE_DIR}/extensions/python")
+    target_include_directories(${testfilename} PRIVATE BEFORE 
"${CMAKE_SOURCE_DIR}/extensions/standard-processors")
+    target_include_directories(${testfilename} PRIVATE BEFORE 
"${CMAKE_SOURCE_DIR}/libminifi/test/")
+    add_definitions(-DPYTHON_SUPPORT)
+    target_link_libraries(${testfilename} minifi-standard-processors 
minifi-python-script-extension minifi-script-extension ${CATCH_MAIN_LIB} 
Python::Python)
+    createTests("${testfilename}")
+    MATH(EXPR EXTENSIONS_TEST_COUNT "${EXTENSIONS_TEST_COUNT}+1")
+    add_test(NAME "${testfilename}" COMMAND "${testfilename}" 
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
+
+    if(EXTENSIONS_TEST_COUNT EQUAL 1)
+        add_custom_command(
+                TARGET "${testfilename}"
+                POST_BUILD
+                COMMAND ${CMAKE_COMMAND} -E copy_directory
+                
"${CMAKE_SOURCE_DIR}/extensions/python/tests/test_python_scripts"
+                "$<TARGET_FILE_DIR:${testfilename}>/test_python_scripts")
+    endif()
+ENDFOREACH()
+
+FOREACH(testfile ${EXECUTEPYTHONPROCESSOR_UNIT_TESTS})
+    get_filename_component(testfilename "${testfile}" NAME_WE)
+    add_executable("${testfilename}" "${testfile}")
+
+    include_directories(${PYTHON_INCLUDE_DIR})
+    include_directories(python)
+    add_definitions(-DPYTHON_SUPPORT)
+
+    target_include_directories(${testfilename} PRIVATE BEFORE 
"${CMAKE_SOURCE_DIR}/extensions/python")
+    target_include_directories(${testfilename} PRIVATE BEFORE 
"${CMAKE_SOURCE_DIR}/extensions/standard-processors")

Review Comment:
   Most of the test rely on the GetFile LogAttribute PutFile workflow (rather 
than SingleProcessorTestController. 
   I 
[updated](https://github.com/apache/nifi-minifi-cpp/pull/1504/commits/1d0fa0778151c3d1fd458d5459e3875953309734#)
 the TestExecuteScriptProcessorWithPythonScript and 
TestExecuteScriptProcessorWithLuaScript so they are more readable and don't 
rely on standard processors. 
   
   I've left the other ones as-is because for example PythonManifest uses 
TestControllerWithFlow which uses GenerateFlowFile (that comes from 
StandardProcessors) 



-- 
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