Skip to content

Commit 71d2e79

Browse files
committed
Look for generated data in tmp_path
Signed-off-by: Domenic Barbuzzi <[email protected]>
1 parent 9c673b2 commit 71d2e79

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

tests/examples/test_quantization_w4a4_fp4.py

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
21
import json
3-
import shlex
42
from pathlib import Path
53
from typing import List
64

@@ -26,7 +24,7 @@ class TestQuantizationW4A4_FP4:
2624
"""
2725

2826
@pytest.mark.parametrize(
29-
"script_filename",
27+
("script_filename"),
3028
[
3129
pytest.param("llama3_example.py"),
3230
pytest.param("llama4_example.py"),
@@ -43,15 +41,13 @@ def test_quantization_w4a4_fp4_example_script(
4341

4442
assert result.returncode == 0, gen_cmd_fail_message(command, result)
4543

46-
# verify that the expected directory got generated
47-
nvfp4_dirs: List[Path] = list(Path.cwd().glob("*-NVFP4"))
48-
assert(len(nvfp4_dirs)) == 1, (
49-
f"unexpectedly found more than one generated folder: {nvfp4_dirs}"
50-
)
51-
print("generated model directory:/n")
52-
print(list(nvfp4_dirs[0].iterdir()))
44+
# verify the expected directory was generated
45+
nvfp4_dirs: List[Path] = list(tmp_path.rglob("*-NVFP4"))
46+
assert (
47+
len(nvfp4_dirs)
48+
) == 1, f"did not find exactly one generated folder: {nvfp4_dirs}"
5349

54-
# is the generated content in the expected format?
55-
config_json = json.loads(Path(nvfp4_dirs[0] / "config.json").read_text())
50+
# verify the format in the generated config
51+
config_json = json.loads((nvfp4_dirs[0] / "config.json").read_text())
5652
config_format = config_json["quantization_config"]["format"]
57-
assert(config_format == "nvfp4-pack-quantized")
53+
assert config_format == "nvfp4-pack-quantized"

0 commit comments

Comments
 (0)