From 3ad3a1beb7b585c60e665cc823280b996ffe59cc Mon Sep 17 00:00:00 2001 From: Liam Sturge Date: Thu, 1 Feb 2024 13:49:36 +0000 Subject: [PATCH] Cut pytest-lazy-fixture Pytest-lazy-fixture doesn't work with version pytest==8.0.0 The following error occurs: AttributeError: 'CallSpec2' object has no attribute 'funcargs' This has been raised as an issue on the pytest-lazy-fixture project, but the repository is not in active development. See https://github.com/TvoroG/pytest-lazy-fixture/issues/65 This patch removes the use of the library to resolve the problem. Change-Id: Ic899e6b7dac12dc786f79ac7052f75475e8546c9 --- .../ubuntu2004_install_python_package.sh | 1 - docker/install/ubuntu_install_python_package.sh | 1 - tests/python/driver/tvmc/test_command_line.py | 17 ++++++++++------- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/docker/install/ubuntu2004_install_python_package.sh b/docker/install/ubuntu2004_install_python_package.sh index b68fc9cba791..f1c03cf1c0e2 100644 --- a/docker/install/ubuntu2004_install_python_package.sh +++ b/docker/install/ubuntu2004_install_python_package.sh @@ -43,5 +43,4 @@ pip3 install --upgrade \ junitparser==2.4.2 \ six \ tornado \ - pytest-lazy-fixture \ git+https://github.com/jax-ml/ml_dtypes.git@v0.2.0 diff --git a/docker/install/ubuntu_install_python_package.sh b/docker/install/ubuntu_install_python_package.sh index 41c8697f4234..593ba15f5947 100755 --- a/docker/install/ubuntu_install_python_package.sh +++ b/docker/install/ubuntu_install_python_package.sh @@ -44,5 +44,4 @@ pip3 install --upgrade \ junitparser==2.4.2 \ six \ tornado \ - pytest-lazy-fixture \ ml_dtypes diff --git a/tests/python/driver/tvmc/test_command_line.py b/tests/python/driver/tvmc/test_command_line.py index cede7b7f992a..2b7d00510058 100644 --- a/tests/python/driver/tvmc/test_command_line.py +++ b/tests/python/driver/tvmc/test_command_line.py @@ -21,7 +21,6 @@ import logging import sys -from pytest_lazyfixture import lazy_fixture from unittest import mock import tvm @@ -128,9 +127,10 @@ def fake_directory(tmp_path): @pytest.mark.parametrize( "invalid_input", - [lazy_fixture("missing_file"), lazy_fixture("broken_symlink"), lazy_fixture("fake_directory")], + ["missing_file", "broken_symlink", "fake_directory"], ) -def test_tvmc_compile_file_check(capsys, invalid_input): +def test_tvmc_compile_file_check(capsys, invalid_input, request): + invalid_input = request.getfixturevalue(invalid_input) compile_cmd = f"tvmc compile --target 'c' {invalid_input}" run_arg = compile_cmd.split(" ")[1:] @@ -147,9 +147,10 @@ def test_tvmc_compile_file_check(capsys, invalid_input): @pytest.mark.parametrize( "invalid_input", - [lazy_fixture("missing_file"), lazy_fixture("broken_symlink"), lazy_fixture("fake_directory")], + ["missing_file", "broken_symlink", "fake_directory"], ) -def test_tvmc_tune_file_check(capsys, invalid_input): +def test_tvmc_tune_file_check(capsys, invalid_input, request): + invalid_input = request.getfixturevalue(invalid_input) tune_cmd = f"tvmc tune --target 'llvm' --output output.json {invalid_input}" run_arg = tune_cmd.split(" ")[1:] @@ -194,13 +195,15 @@ def paddle_model(paddle_resnet50): @pytest.mark.parametrize( "model", [ - lazy_fixture("paddle_model"), + "paddle_model", ], ) # compile_model() can take too long and is tested elsewhere, hence it's mocked below @mock.patch.object(compiler, "compile_model") # @mock.patch.object(compiler, "compile_model") -def test_tvmc_compile_input_model(mock_compile_model, tmpdir_factory, model): +def test_tvmc_compile_input_model(mock_compile_model, tmpdir_factory, model, request): + + model = request.getfixturevalue(model) output_dir = tmpdir_factory.mktemp("output") output_file = output_dir / "model.tar"