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
OpenDAS
vision
Commits
87ec8048
Unverified
Commit
87ec8048
authored
Feb 09, 2023
by
Philip Meier
Committed by
GitHub
Feb 09, 2023
Browse files
skip CPU tests on GPU GHA jobs (#6970)
parent
f47e70e8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
test/common_utils.py
test/common_utils.py
+2
-2
test/conftest.py
test/conftest.py
+5
-5
No files found.
test/common_utils.py
View file @
87ec8048
...
...
@@ -13,11 +13,11 @@ from torchvision import io
import
__main__
# noqa: 401
IN_
CIRCLE
_CI
=
os
.
getenv
(
"CIRCLECI"
,
False
)
==
"true"
IN_
OSS
_CI
=
any
(
os
.
getenv
(
var
)
==
"true"
for
var
in
[
"CIRCLECI"
,
"GITHUB_ACTIONS"
])
IN_RE_WORKER
=
os
.
environ
.
get
(
"INSIDE_RE_WORKER"
)
is
not
None
IN_FBCODE
=
os
.
environ
.
get
(
"IN_FBCODE_TORCHVISION"
)
==
"1"
CUDA_NOT_AVAILABLE_MSG
=
"CUDA device not available"
CIRCLE
CI_GPU_NO_CUDA_MSG
=
"We're in a
CircleCI
GPU machine, and this test doesn't need cuda."
OSS_
CI_GPU_NO_CUDA_MSG
=
"We're in a
n OSS
GPU machine, and this test doesn't need cuda."
@
contextlib
.
contextmanager
...
...
test/conftest.py
View file @
87ec8048
...
...
@@ -3,7 +3,7 @@ import random
import
numpy
as
np
import
pytest
import
torch
from
common_utils
import
C
IRCLECI_GPU_NO_CUDA_MSG
,
CUDA_NOT_AVAILABLE_MSG
,
IN_CIRCLE_CI
,
IN_FBCODE
,
IN_RE_WORKER
from
common_utils
import
C
UDA_NOT_AVAILABLE_MSG
,
IN_FBCODE
,
IN_OSS_CI
,
IN_RE_WORKER
,
OSS_CI_GPU_NO_CUDA_MSG
def
pytest_configure
(
config
):
...
...
@@ -18,7 +18,7 @@ def pytest_collection_modifyitems(items):
#
# Typically, here, we try to optimize CI time. In particular, the GPU CI instances don't need to run the
# tests that don't need CUDA, because those tests are extensively tested in the CPU CI instances already.
# This is true for both
Circle
CI and the fbcode internal CI.
# This is true for both
OSS
CI and the fbcode internal CI.
# In the fbcode CI, we have an additional constraint: we try to avoid skipping tests. So instead of relying on
# pytest.mark.skip, in fbcode we literally just remove those tests from the `items` list, and it's as if
# these tests never existed.
...
...
@@ -49,12 +49,12 @@ def pytest_collection_modifyitems(items):
# TODO: something more robust would be to do that only in a sandcastle instance,
# so that we can still see the test being skipped when testing locally from a devvm
continue
elif
IN_
CIRCLE
_CI
:
elif
IN_
OSS
_CI
:
# Here we're not in fbcode, so we can safely collect and skip tests.
if
not
needs_cuda
and
torch
.
cuda
.
is_available
():
# Similar to what happens in RE workers: we don't need the
Circle
CI GPU machines
# Similar to what happens in RE workers: we don't need the
OSS
CI GPU machines
# to run the CPU-only tests.
item
.
add_marker
(
pytest
.
mark
.
skip
(
reason
=
CIRCLE
CI_GPU_NO_CUDA_MSG
))
item
.
add_marker
(
pytest
.
mark
.
skip
(
reason
=
OSS_
CI_GPU_NO_CUDA_MSG
))
if
item
.
get_closest_marker
(
"dont_collect"
)
is
not
None
:
# currently, this is only used for some tests we're sure we don't want to run on fbcode
...
...
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