Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update unit_tests.rst #10799

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

paperfront
Copy link

@paperfront paperfront commented Sep 4, 2024

When following the instructions described in https://xgboost.readthedocs.io/en/stable/contrib/unit_tests.html#running-pytest to run the python unit tests locally, the following tests will fail:

FAILED tests/python/test_cli.py::TestCLI::test_cli_model - AssertionError: assert False
FAILED tests/python/test_cli.py::TestCLI::test_cli_help - AssertionError: assert False
FAILED tests/python/test_cli.py::TestCLI::test_cli_model_json - AssertionError: assert False
FAILED tests/python/test_cli.py::TestCLI::test_cli_save_model - AssertionError: assert False
FAILED tests/python/test_demos.py::test_cli_regression_demo - FileNotFoundError: [Errno 2] No such file or directory: '/Users/mlacayo/xgboost/demo/../xgboost'
FAILED tests/python/test_demos.py::test_cli_binary_classification - subprocess.CalledProcessError: Command '['./runexp.sh']' returned non-zero exit status 1.

The reason for these errors is because the default CMake build options exclude the building of the CLI (behavior introduced in #9485 )

To help avoid confusion, I updated the python section of the unit test documentation to mention this build option.

Here is a sample stack trace for the test_cli_model test case that shows that the executable is missing:

self = <test_cli.TestCLI object at 0x123c78890>

    def get_exe(self):
        if platform.system() == 'Windows':
            exe = 'xgboost.exe'
        else:
            exe = 'xgboost'
        exe = os.path.join(self.PROJECT_ROOT, exe)
>       assert os.path.exists(exe)
E       AssertionError: assert False
E        +  where False = <function exists at 0x104b47600>('/Users/mlacayo/xgboost/xgboost')
E        +    where <function exists at 0x104b47600> = <module 'posixpath' (frozen)>.exists
E        +      where <module 'posixpath' (frozen)> = os.path

…tion of the deprecated CLI, which is used in the tests
Copy link
Member

@trivialfis trivialfis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for raising this issue. Do you think it's better to automatically skip the tests using pytest.mark.skip?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants