Commit 69eb9e6f authored by Muyang Li's avatar Muyang Li
Browse files

chore: better test logs

parent 92d75723
...@@ -108,13 +108,13 @@ jobs: ...@@ -108,13 +108,13 @@ jobs:
pwd pwd
cd ../ComfyUI cd ../ComfyUI
python nunchaku_tests/scripts/nunchaku-flux1-dev.py python nunchaku_tests/scripts/nunchaku-flux1-dev.py
pytest -s nunchaku_tests/ pytest -s -x nunchaku_tests/
- name: Run nunchaku tests - name: Run nunchaku tests
run: | run: |
source $(conda info --base)/etc/profile.d/conda.sh source $(conda info --base)/etc/profile.d/conda.sh
conda activate test_env || { echo "Failed to activate conda env"; exit 1; } conda activate test_env || { echo "Failed to activate conda env"; exit 1; }
which python which python
pytest -s tests/flux/test_flux_examples.py pytest -s -x tests/flux/test_flux_examples.py
python .github/workflows/run_all_tests.py python .github/workflows/run_all_tests.py
- name: clean up - name: clean up
if: always() if: always()
......
...@@ -21,7 +21,7 @@ def run_all_tests(): ...@@ -21,7 +21,7 @@ def run_all_tests():
failed_tests = [] failed_tests = []
for test_file in test_files: for test_file in test_files:
print(f"Running {test_file} ...") print(f"Running {test_file} ...")
result = subprocess.run(["pytest", "--reruns", "2", "--reruns-delay", "0", "-s", test_file]) result = subprocess.run(["pytest", "--reruns", "2", "--reruns-delay", "0", "-s", "-x", test_file])
if result.returncode != 0: if result.returncode != 0:
print(f"Test failed: {test_file}") print(f"Test failed: {test_file}")
failed_tests.append(test_file) failed_tests.append(test_file)
......
...@@ -12,9 +12,7 @@ example_scripts = [f for f in os.listdir(EXAMPLES_DIR) if f.endswith(".py") and ...@@ -12,9 +12,7 @@ example_scripts = [f for f in os.listdir(EXAMPLES_DIR) if f.endswith(".py") and
@pytest.mark.parametrize("script_name", example_scripts) @pytest.mark.parametrize("script_name", example_scripts)
def test_example_script_runs(script_name): def test_example_script_runs(script_name):
gc.collect()
torch.cuda.empty_cache()
script_path = os.path.join(EXAMPLES_DIR, script_name) script_path = os.path.join(EXAMPLES_DIR, script_name)
result = subprocess.run(["python", script_path], capture_output=True, text=True) result = subprocess.run(["python", script_path], text=True)
print(f"Running {script_path} -> Return code: {result.returncode}") print(f"Running {script_path} -> Return code: {result.returncode}")
assert result.returncode == 0, f"{script_path} failed with code {result.returncode}" assert result.returncode == 0, f"{script_path} failed with code {result.returncode}"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment