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
chenpangpang
transformers
Commits
7bd16b87
Unverified
Commit
7bd16b87
authored
Sep 14, 2021
by
Sylvain Gugger
Committed by
GitHub
Sep 14, 2021
Browse files
Fix test_fetcher when setup is updated (#13566)
* Fix test_fetcher when setup is updated * Remove example
parent
054b6013
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
20 deletions
+24
-20
utils/tests_fetcher.py
utils/tests_fetcher.py
+24
-20
No files found.
utils/tests_fetcher.py
View file @
7bd16b87
...
@@ -417,26 +417,30 @@ def infer_tests_to_run(output_file, diff_with_last_commit=False, filters=None):
...
@@ -417,26 +417,30 @@ def infer_tests_to_run(output_file, diff_with_last_commit=False, filters=None):
print
(
f
"
\n
### IMPACTED FILES ###
\n
{
_print_list
(
impacted_files
)
}
"
)
print
(
f
"
\n
### IMPACTED FILES ###
\n
{
_print_list
(
impacted_files
)
}
"
)
# Grab the corresponding test files:
# Grab the corresponding test files:
test_files_to_run
=
[]
if
"setup.py"
in
impacted_files
:
for
f
in
impacted_files
:
test_files_to_run
=
[
"tests"
]
# Modified test files are always added
else
:
if
f
.
startswith
(
"tests/"
):
# Grab the corresponding test files:
test_files_to_run
.
append
(
f
)
test_files_to_run
=
[]
else
:
for
f
in
impacted_files
:
new_tests
=
module_to_test_file
(
f
)
# Modified test files are always added
if
new_tests
is
not
None
:
if
f
.
startswith
(
"tests/"
):
if
isinstance
(
new_tests
,
str
):
test_files_to_run
.
append
(
f
)
test_files_to_run
.
append
(
new_tests
)
else
:
else
:
new_tests
=
module_to_test_file
(
f
)
test_files_to_run
.
extend
(
new_tests
)
if
new_tests
is
not
None
:
if
isinstance
(
new_tests
,
str
):
# Remove duplicates
test_files_to_run
.
append
(
new_tests
)
test_files_to_run
=
sorted
(
list
(
set
(
test_files_to_run
)))
else
:
# Make sure we did not end up with a test file that was removed
test_files_to_run
.
extend
(
new_tests
)
test_files_to_run
=
[
f
for
f
in
test_files_to_run
if
os
.
path
.
isfile
(
f
)
or
os
.
path
.
isdir
(
f
)]
if
filters
is
not
None
:
# Remove duplicates
for
filter
in
filters
:
test_files_to_run
=
sorted
(
list
(
set
(
test_files_to_run
)))
test_files_to_run
=
[
f
for
f
in
test_files_to_run
if
f
.
startswith
(
filter
)]
# Make sure we did not end up with a test file that was removed
test_files_to_run
=
[
f
for
f
in
test_files_to_run
if
os
.
path
.
isfile
(
f
)
or
os
.
path
.
isdir
(
f
)]
if
filters
is
not
None
:
for
filter
in
filters
:
test_files_to_run
=
[
f
for
f
in
test_files_to_run
if
f
.
startswith
(
filter
)]
print
(
f
"
\n
### TEST TO RUN ###
\n
{
_print_list
(
test_files_to_run
)
}
"
)
print
(
f
"
\n
### TEST TO RUN ###
\n
{
_print_list
(
test_files_to_run
)
}
"
)
if
len
(
test_files_to_run
)
>
0
:
if
len
(
test_files_to_run
)
>
0
:
...
...
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