diff --git a/.github/workflows/test_cli_cpu_ipex.yaml b/.github/workflows/test_cli_cpu_ipex.yaml index f1d2b593..fa502905 100644 --- a/.github/workflows/test_cli_cpu_ipex.yaml +++ b/.github/workflows/test_cli_cpu_ipex.yaml @@ -55,4 +55,10 @@ jobs: - name: Run tests from example folder run: | pytest tests/test_examples.py -s -k "cpu and ipex" - continue-on-error: ${{ failure() && steps.run.outcome == 'failure' && steps.run.exit_code == 5 }} + EXIT_CODE=$? + if [ $EXIT_CODE -eq 5 ]; then + echo "No tests were collected. Skipping failure..." + exit 0 + else + exit $EXIT_CODE + fi diff --git a/.github/workflows/test_cli_cpu_llama_cpp.yaml b/.github/workflows/test_cli_cpu_llama_cpp.yaml index c85b69f8..12c4da30 100644 --- a/.github/workflows/test_cli_cpu_llama_cpp.yaml +++ b/.github/workflows/test_cli_cpu_llama_cpp.yaml @@ -55,4 +55,10 @@ jobs: - name: Run tests from example folder run: | pytest tests/test_examples.py -s -k "cpu and llama_cpp" - continue-on-error: ${{ failure() && steps.run.outcome == 'failure' && steps.run.exit_code == 5 }} + EXIT_CODE=$? + if [ $EXIT_CODE -eq 5 ]; then + echo "No tests were collected. Skipping failure..." + exit 0 + else + exit $EXIT_CODE + fi \ No newline at end of file diff --git a/.github/workflows/test_cli_cpu_neural_compressor.yaml b/.github/workflows/test_cli_cpu_neural_compressor.yaml index 76fb6f08..8aef6b95 100644 --- a/.github/workflows/test_cli_cpu_neural_compressor.yaml +++ b/.github/workflows/test_cli_cpu_neural_compressor.yaml @@ -55,4 +55,10 @@ jobs: - name: Run tests from example folder run: | pytest tests/test_examples.py -s -k "cpu and neural_compressor" - continue-on-error: ${{ failure() && steps.run.outcome == 'failure' && steps.run.exit_code == 5 }} + EXIT_CODE=$? + if [ $EXIT_CODE -eq 5 ]; then + echo "No tests were collected. Skipping failure..." + exit 0 + else + exit $EXIT_CODE + fi \ No newline at end of file diff --git a/.github/workflows/test_cli_cpu_onnxruntime.yaml b/.github/workflows/test_cli_cpu_onnxruntime.yaml index 5bc46e89..255f0405 100644 --- a/.github/workflows/test_cli_cpu_onnxruntime.yaml +++ b/.github/workflows/test_cli_cpu_onnxruntime.yaml @@ -55,4 +55,10 @@ jobs: - name: Run tests from example folder run: | pytest tests/test_examples.py -s -k "cpu and onnxruntime" - continue-on-error: ${{ failure() && steps.run.outcome == 'failure' && steps.run.exit_code == 5 }} + EXIT_CODE=$? + if [ $EXIT_CODE -eq 5 ]; then + echo "No tests were collected. Skipping failure..." + exit 0 + else + exit $EXIT_CODE + fi \ No newline at end of file diff --git a/.github/workflows/test_cli_cpu_openvino.yaml b/.github/workflows/test_cli_cpu_openvino.yaml index 0f72e7e2..522e2fee 100644 --- a/.github/workflows/test_cli_cpu_openvino.yaml +++ b/.github/workflows/test_cli_cpu_openvino.yaml @@ -55,4 +55,10 @@ jobs: - name: Run tests from example folder run: | pytest tests/test_examples.py -s -k "cpu and openvino" - continue-on-error: ${{ failure() && steps.run.outcome == 'failure' && steps.run.exit_code == 5 }} + EXIT_CODE=$? + if [ $EXIT_CODE -eq 5 ]; then + echo "No tests were collected. Skipping failure..." + exit 0 + else + exit $EXIT_CODE + fi \ No newline at end of file diff --git a/.github/workflows/test_cli_cpu_py_txi.yaml b/.github/workflows/test_cli_cpu_py_txi.yaml index df404834..5416793c 100644 --- a/.github/workflows/test_cli_cpu_py_txi.yaml +++ b/.github/workflows/test_cli_cpu_py_txi.yaml @@ -55,4 +55,10 @@ jobs: - name: Run tests from example folder run: | pytest tests/test_examples.py -s -k "examples and cpu and py_txi" - continue-on-error: ${{ failure() && steps.run.outcome == 'failure' && steps.run.exit_code == 5 }} + EXIT_CODE=$? + if [ $EXIT_CODE -eq 5 ]; then + echo "No tests were collected. Skipping failure..." + exit 0 + else + exit $EXIT_CODE + fi \ No newline at end of file diff --git a/.github/workflows/test_cli_cpu_pytorch.yaml b/.github/workflows/test_cli_cpu_pytorch.yaml index ca2a4e07..c8d4e540 100644 --- a/.github/workflows/test_cli_cpu_pytorch.yaml +++ b/.github/workflows/test_cli_cpu_pytorch.yaml @@ -55,6 +55,11 @@ jobs: - name: Run tests from example folder run: | pytest tests/test_examples.py -s -k "cpu and pytorch" - continue-on-error: ${{ failure() && steps.run.outcome == 'failure' && steps.run.exit_code == 5 }} - - + EXIT_CODE=$? + if [ $EXIT_CODE -eq 5 ]; then + echo "No tests were collected. Skipping failure..." + exit 0 + else + exit $EXIT_CODE + fi + \ No newline at end of file diff --git a/.github/workflows/test_cli_cuda_onnxruntime.yaml b/.github/workflows/test_cli_cuda_onnxruntime.yaml index beac01d0..833be6b9 100644 --- a/.github/workflows/test_cli_cuda_onnxruntime.yaml +++ b/.github/workflows/test_cli_cuda_onnxruntime.yaml @@ -53,4 +53,10 @@ jobs: - name: Run tests from example folder run: | pytest tests/test_examples.py -x -s -k "cuda and onnxruntime" - continue-on-error: ${{ failure() && steps.run.outcome == 'failure' && steps.run.exit_code == 5 }} + EXIT_CODE=$? + if [ $EXIT_CODE -eq 5 ]; then + echo "No tests were collected. Skipping failure..." + exit 0 + else + exit $EXIT_CODE + fi \ No newline at end of file diff --git a/.github/workflows/test_cli_cuda_py_txi.yaml b/.github/workflows/test_cli_cuda_py_txi.yaml index 66a2a56d..5107bde4 100644 --- a/.github/workflows/test_cli_cuda_py_txi.yaml +++ b/.github/workflows/test_cli_cuda_py_txi.yaml @@ -55,5 +55,10 @@ jobs: - name: Run tests from example folder run: | pytest tests/test_examples.py -x -s -k "cuda and py_txi" - continue-on-error: ${{ failure() && steps.run.outcome == 'failure' && steps.run.exit_code == 5 }} - + EXIT_CODE=$? + if [ $EXIT_CODE -eq 5 ]; then + echo "No tests were collected. Skipping failure..." + exit 0 + else + exit $EXIT_CODE + fi \ No newline at end of file diff --git a/.github/workflows/test_cli_cuda_pytorch.yaml b/.github/workflows/test_cli_cuda_pytorch.yaml index bfab7a69..943da610 100644 --- a/.github/workflows/test_cli_cuda_pytorch.yaml +++ b/.github/workflows/test_cli_cuda_pytorch.yaml @@ -88,4 +88,10 @@ jobs: - name: Run test from example folder run: | pytest tests/test_examples.py -x -s -k "cuda and pytorch" - continue-on-error: ${{ failure() && steps.run.outcome == 'failure' && steps.run.exit_code == 5 }} + EXIT_CODE=$? + if [ $EXIT_CODE -eq 5 ]; then + echo "No tests were collected. Skipping failure..." + exit 0 + else + exit $EXIT_CODE + fi \ No newline at end of file diff --git a/.github/workflows/test_cli_cuda_tensorrt_llm.yaml b/.github/workflows/test_cli_cuda_tensorrt_llm.yaml index bb2d7db3..7a3b63de 100644 --- a/.github/workflows/test_cli_cuda_tensorrt_llm.yaml +++ b/.github/workflows/test_cli_cuda_tensorrt_llm.yaml @@ -84,4 +84,10 @@ jobs: - name: Run tests from example folder run: | pytest tests/test_examples.py -x -s -k "cuda and tensorrt_llm" - continue-on-error: ${{ failure() && steps.run.outcome == 'failure' && steps.run.exit_code == 5 }} + EXIT_CODE=$? + if [ $EXIT_CODE -eq 5 ]; then + echo "No tests were collected. Skipping failure..." + exit 0 + else + exit $EXIT_CODE + fi \ No newline at end of file diff --git a/.github/workflows/test_cli_cuda_torch_ort.yaml b/.github/workflows/test_cli_cuda_torch_ort.yaml index e48e641f..6afc7cef 100644 --- a/.github/workflows/test_cli_cuda_torch_ort.yaml +++ b/.github/workflows/test_cli_cuda_torch_ort.yaml @@ -86,4 +86,10 @@ jobs: - name: Run tests from example folder run: | pytest tests/test_examples.py -x -s -k "cuda and torch_ort" - continue-on-error: ${{ failure() && steps.run.outcome == 'failure' && steps.run.exit_code == 5 }} + EXIT_CODE=$? + if [ $EXIT_CODE -eq 5 ]; then + echo "No tests were collected. Skipping failure..." + exit 0 + else + exit $EXIT_CODE + fi \ No newline at end of file diff --git a/.github/workflows/test_cli_cuda_vllm.yaml b/.github/workflows/test_cli_cuda_vllm.yaml index 24ee2489..7a961c06 100644 --- a/.github/workflows/test_cli_cuda_vllm.yaml +++ b/.github/workflows/test_cli_cuda_vllm.yaml @@ -85,4 +85,10 @@ jobs: - name: Run tests from example folder run: | pytest tests/test_examples.py -x -s -k "cuda and vllm" - continue-on-error: ${{ failure() && steps.run.outcome == 'failure' && steps.run.exit_code == 5 }} + EXIT_CODE=$? + if [ $EXIT_CODE -eq 5 ]; then + echo "No tests were collected. Skipping failure..." + exit 0 + else + exit $EXIT_CODE + fi \ No newline at end of file diff --git a/.github/workflows/test_cli_misc.yaml b/.github/workflows/test_cli_misc.yaml index 84fd07bd..53a45151 100644 --- a/.github/workflows/test_cli_misc.yaml +++ b/.github/workflows/test_cli_misc.yaml @@ -68,4 +68,10 @@ jobs: - name: Run tests from example folder run: | pytest tests/test_examples_folder.py -s -k "examples and not (cpu or cuda or rocm or mps)" - continue-on-error: ${{ failure() && steps.run.outcome == 'failure' && steps.run.exit_code == 5 }} + EXIT_CODE=$? + if [ $EXIT_CODE -eq 5 ]; then + echo "No tests were collected. Skipping failure..." + exit 0 + else + exit $EXIT_CODE + fi \ No newline at end of file diff --git a/.github/workflows/test_cli_rocm_pytorch.yaml b/.github/workflows/test_cli_rocm_pytorch.yaml index b4c40135..7f736b63 100644 --- a/.github/workflows/test_cli_rocm_pytorch.yaml +++ b/.github/workflows/test_cli_rocm_pytorch.yaml @@ -95,4 +95,10 @@ jobs: - name: Run tests from example folder run: | pytest tests/test_examples.py -x -s -k "cuda and pytorch" - continue-on-error: ${{ failure() && steps.run.outcome == 'failure' && steps.run.exit_code == 5 }} + EXIT_CODE=$? + if [ $EXIT_CODE -eq 5 ]; then + echo "No tests were collected. Skipping failure..." + exit 0 + else + exit $EXIT_CODE + fi \ No newline at end of file diff --git a/tests/test_examples.py b/tests/test_examples.py index ab946c61..765ab8f2 100644 --- a/tests/test_examples.py +++ b/tests/test_examples.py @@ -73,8 +73,8 @@ ] CUDA_PYTORCH_SCRIPTS = [ - "examples/pytorch_bert.py", - "examples/pytorch_llama.py", + "pytorch_bert.py", + "pytorch_llama.py", ] ALL_YAML_CONFIGS = ( @@ -128,9 +128,10 @@ def test_yaml_config(config_name): assert len(output_files) > 0, f"No output files found for {config_name}" -def execute_python_script(script_path): +def execute_python_script(script_name): + script_path = EXAMPLES_DIR / script_name # Run the example file as a separate process - result = subprocess.run([sys.executable, script_path], capture_output=True, text=True) + result = subprocess.run([sys.executable, str(script_path)], capture_output=True, text=True) # Check that the process completed successfully (return code 0) assert result.returncode == 0, f"Script {script_path} failed with error:\n{result.stderr}" @@ -189,6 +190,6 @@ def test_cuda_vllm_configs(config_name): test_yaml_config(config_name) -@pytest.mark.parametrize("script_path", CUDA_PYTORCH_SCRIPTS) -def test_cuda_pytorch_scripts(script_path): - execute_python_script(script_path) +@pytest.mark.parametrize("script_name", CUDA_PYTORCH_SCRIPTS) +def test_cuda_pytorch_scripts(script_name): + execute_python_script(script_name)