diff --git a/tests/conftest.py b/tests/conftest.py index c4568db2..3ed0774b 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -68,3 +68,7 @@ def pytest_configure(config): "markers", "pleasefixme: marks test as needing fixes (will be skipped in CI)", ) + config.addinivalue_line( + "markers", + "run_only_on: marks test to run only on specific hardware (CPU/GPU)", + ) diff --git a/tests/functional_tests/mcore/recipes/test_dit_pretrain.py b/tests/functional_tests/mcore/recipes/test_dit_pretrain.py index 87d5b0cf..e5ca6ff4 100644 --- a/tests/functional_tests/mcore/recipes/test_dit_pretrain.py +++ b/tests/functional_tests/mcore/recipes/test_dit_pretrain.py @@ -63,8 +63,8 @@ def test_DiT_pretrain_mock(self, tmp_path): ] # Run the command with a timeout + result = None try: - # Stream output in real-time instead of capturing it result = subprocess.run( cmd, capture_output=True, @@ -73,14 +73,16 @@ def test_DiT_pretrain_mock(self, tmp_path): check=True, ) - # Print output for debugging if needed - print("STDOUT:", result.stdout) - print("STDERR:", result.stderr) - # Basic verification that the run completed assert result.returncode == 0, f"Command failed with return code {result.returncode}" except subprocess.TimeoutExpired: pytest.fail("DiT pretrain mock run exceeded timeout of 1800 seconds (30 minutes)") except subprocess.CalledProcessError as e: + result = e pytest.fail(f"DiT pretrain mock run failed with return code {e.returncode}") + finally: + # Always print output for debugging + if result is not None: + print("STDOUT:", result.stdout) + print("STDERR:", result.stderr) diff --git a/tests/functional_tests/mcore/recipes/test_wan_pretrain.py b/tests/functional_tests/mcore/recipes/test_wan_pretrain.py index 0c9879d9..b4b109ce 100644 --- a/tests/functional_tests/mcore/recipes/test_wan_pretrain.py +++ b/tests/functional_tests/mcore/recipes/test_wan_pretrain.py @@ -81,8 +81,8 @@ def test_wan_pretrain_mock(self, tmp_path): ] # Run the command with a timeout + result = None try: - # Stream output in real-time instead of capturing it result = subprocess.run( cmd, capture_output=True, @@ -91,14 +91,16 @@ def test_wan_pretrain_mock(self, tmp_path): check=True, ) - # Print output for debugging if needed - print("STDOUT:", result.stdout) - print("STDERR:", result.stderr) - # Basic verification that the run completed assert result.returncode == 0, f"Command failed with return code {result.returncode}" except subprocess.TimeoutExpired: pytest.fail("WAN pretrain mock run exceeded timeout of 1800 seconds (30 minutes)") except subprocess.CalledProcessError as e: + result = e pytest.fail(f"WAN pretrain mock run failed with return code {e.returncode}") + finally: + # Always print output for debugging + if result is not None: + print("STDOUT:", result.stdout) + print("STDERR:", result.stderr)