Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
tianlh
LightGBM-DCU
Commits
d5150394
Unverified
Commit
d5150394
authored
Sep 03, 2024
by
vnherdeiro
Committed by
GitHub
Sep 02, 2024
Browse files
[ci] prevent Python tests from leaving behind files (#6626)
Co-authored-by:
James Lamb
<
jaylamb20@gmail.com
>
parent
15ac2f7b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
5 deletions
+8
-5
tests/python_package_test/test_dask.py
tests/python_package_test/test_dask.py
+2
-2
tests/python_package_test/test_plotting.py
tests/python_package_test/test_plotting.py
+6
-3
No files found.
tests/python_package_test/test_dask.py
View file @
d5150394
...
...
@@ -1527,11 +1527,11 @@ def test_predict_with_raw_score(task, output, cluster):
assert_eq
(
raw_predictions
,
pred_proba_raw
)
def
test_distributed_quantized_training
(
cluster
):
def
test_distributed_quantized_training
(
tmp_path
,
cluster
):
with
Client
(
cluster
)
as
client
:
X
,
y
,
w
,
_
,
dX
,
dy
,
dw
,
_
=
_create_data
(
objective
=
"regression"
,
output
=
"array"
)
np
.
savetxt
(
"data_dask.csv"
,
np
.
hstack
([
np
.
array
([
y
]).
T
,
X
]),
fmt
=
"%f,%f,%f,%f,%f"
)
np
.
savetxt
(
tmp_path
/
"data_dask.csv"
,
np
.
hstack
([
np
.
array
([
y
]).
T
,
X
]),
fmt
=
"%f,%f,%f,%f,%f"
)
params
=
{
"boosting_type"
:
"gbdt"
,
...
...
tests/python_package_test/test_plotting.py
View file @
d5150394
...
...
@@ -177,7 +177,7 @@ def test_plot_tree(breast_cancer_split):
@
pytest
.
mark
.
skipif
(
not
GRAPHVIZ_INSTALLED
,
reason
=
"graphviz is not installed"
)
def
test_create_tree_digraph
(
breast_cancer_split
):
def
test_create_tree_digraph
(
tmp_path
,
breast_cancer_split
):
X_train
,
_
,
y_train
,
_
=
breast_cancer_split
constraints
=
[
-
1
,
1
]
*
int
(
X_train
.
shape
[
1
]
/
2
)
...
...
@@ -193,6 +193,7 @@ def test_create_tree_digraph(breast_cancer_split):
show_info
=
[
"split_gain"
,
"internal_value"
,
"internal_weight"
],
name
=
"Tree4"
,
node_attr
=
{
"color"
:
"red"
},
directory
=
tmp_path
,
)
graph
.
render
(
view
=
False
)
assert
isinstance
(
graph
,
graphviz
.
Digraph
)
...
...
@@ -213,7 +214,7 @@ def test_create_tree_digraph(breast_cancer_split):
@
pytest
.
mark
.
skipif
(
not
GRAPHVIZ_INSTALLED
,
reason
=
"graphviz is not installed"
)
def
test_tree_with_categories_below_max_category_values
():
def
test_tree_with_categories_below_max_category_values
(
tmp_path
):
X_train
,
y_train
=
_categorical_data
(
2
,
10
)
params
=
{
"n_estimators"
:
10
,
...
...
@@ -238,6 +239,7 @@ def test_tree_with_categories_below_max_category_values():
name
=
"Tree4"
,
node_attr
=
{
"color"
:
"red"
},
max_category_values
=
10
,
directory
=
tmp_path
,
)
graph
.
render
(
view
=
False
)
assert
isinstance
(
graph
,
graphviz
.
Digraph
)
...
...
@@ -257,7 +259,7 @@ def test_tree_with_categories_below_max_category_values():
@
pytest
.
mark
.
skipif
(
not
GRAPHVIZ_INSTALLED
,
reason
=
"graphviz is not installed"
)
def
test_tree_with_categories_above_max_category_values
():
def
test_tree_with_categories_above_max_category_values
(
tmp_path
):
X_train
,
y_train
=
_categorical_data
(
20
,
30
)
params
=
{
"n_estimators"
:
10
,
...
...
@@ -282,6 +284,7 @@ def test_tree_with_categories_above_max_category_values():
name
=
"Tree4"
,
node_attr
=
{
"color"
:
"red"
},
max_category_values
=
4
,
directory
=
tmp_path
,
)
graph
.
render
(
view
=
False
)
assert
isinstance
(
graph
,
graphviz
.
Digraph
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment