Move Python testing utilities into xgboost module. (#8379)

- Add typehints.
- Fixes for pylint.

Co-authored-by: Hyunsu Philip Cho <chohyu01@cs.washington.edu>
This commit is contained in:
Jiaming Yuan
2022-10-26 16:56:11 +08:00
committed by GitHub
parent 7e53189e7c
commit cf70864fa3
66 changed files with 652 additions and 595 deletions

View File

@@ -1,20 +1,15 @@
import itertools
import os
import shutil
import sys
import urllib.request
import zipfile
import numpy as np
import xgboost
from xgboost import testing
from xgboost import testing as tm
sys.path.append("tests/python")
import testing as tm # noqa
pytestmark = testing.timeout(10)
pytestmark = tm.timeout(10)
class TestRanking:
@@ -24,8 +19,9 @@ class TestRanking:
Download and setup the test fixtures
"""
from sklearn.datasets import load_svmlight_files
# download the test data
cls.dpath = os.path.join(tm.PROJECT_ROOT, "demo/rank/")
cls.dpath = os.path.join(tm.demo_dir(__file__), "rank/")
src = 'https://s3-us-west-2.amazonaws.com/xgboost-examples/MQ2008.zip'
target = os.path.join(cls.dpath, "MQ2008.zip")