Group CLI demo into subdirectory. (#6258)

CLI is not most developed interface. Putting them into correct directory can help new users to avoid it as most of the use cases are from a language binding.
This commit is contained in:
Jiaming Yuan
2020-10-29 05:40:44 +08:00
committed by GitHub
parent 6383757dca
commit dfac5f89e9
32 changed files with 146 additions and 100 deletions

View File

@@ -2,11 +2,13 @@ import os
import subprocess
import pytest
import testing as tm
import sys
ROOT_DIR = tm.PROJECT_ROOT
DEMO_DIR = os.path.join(ROOT_DIR, 'demo')
PYTHON_DEMO_DIR = os.path.join(DEMO_DIR, 'guide-python')
CLI_DEMO_DIR = os.path.join(DEMO_DIR, 'CLI')
def test_basic_walkthrough():
@@ -132,7 +134,7 @@ def test_callbacks_demo():
def test_cli_regression_demo():
reg_dir = os.path.join(DEMO_DIR, 'regression')
reg_dir = os.path.join(CLI_DEMO_DIR, 'regression')
script = os.path.join(reg_dir, 'mapfeat.py')
cmd = ['python', script]
subprocess.check_call(cmd, cwd=reg_dir)
@@ -144,3 +146,15 @@ def test_cli_regression_demo():
exe = os.path.join(tm.PROJECT_ROOT, 'xgboost')
conf = os.path.join(reg_dir, 'machine.conf')
subprocess.check_call([exe, conf], cwd=reg_dir)
@pytest.mark.skipif(condition=sys.platform.startswith("win"),
reason='Test requires sh execution.')
def test_cli_binary_classification():
cls_dir = os.path.join(CLI_DEMO_DIR, 'binary_classification')
with tm.DirectoryExcursion(cls_dir, cleanup=True):
subprocess.check_call(['./runexp.sh'])
os.remove('0002.model')
# year prediction is not tested due to data size being too large.
# rank is not tested as it requires unrar command.