(self, bst: Union[xgb.Booster, xgb.XGBModel])
| 40 | args_template = ["pytest", "--verbose", "-s", "--fulltrace"] |
| 41 | |
| 42 | def run_pickling(self, bst: Union[xgb.Booster, xgb.XGBModel]) -> None: |
| 43 | save_pickle(bst, model_path) |
| 44 | args = [ |
| 45 | "pytest", |
| 46 | "--verbose", |
| 47 | "-s", |
| 48 | "--fulltrace", |
| 49 | "./tests/python-gpu/load_pickle.py::TestLoadPickle::test_load_pkl", |
| 50 | ] |
| 51 | command = "" |
| 52 | for arg in args: |
| 53 | command += arg |
| 54 | command += " " |
| 55 | |
| 56 | cuda_environment = {"CUDA_VISIBLE_DEVICES": "-1"} |
| 57 | env = os.environ.copy() |
| 58 | # Passing new_environment directly to `env' argument results |
| 59 | # in failure on Windows: |
| 60 | # Fatal Python error: _Py_HashRandomization_Init: failed to |
| 61 | # get random numbers to initialize Python |
| 62 | env.update(cuda_environment) |
| 63 | |
| 64 | # Load model in a CPU only environment. |
| 65 | status = subprocess.call(command, env=env, shell=True) |
| 66 | assert status == 0 |
| 67 | os.remove(model_path) |
| 68 | |
| 69 | # TODO: This test is too slow |
| 70 | @pytest.mark.skipif(**tm.no_sklearn()) |
no test coverage detected