Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
declearn2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Magnet
DecLearn
declearn2
Commits
5fe5ed7c
Verified
Commit
5fe5ed7c
authored
2 years ago
by
ANDREY Paul
Browse files
Options
Downloads
Patches
Plain Diff
Add a '--cpu-only' mode for unit tests.
parent
45def4ed
Branches
Branches containing commit
No related tags found
1 merge request
!39
Improve the test suite
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
test/conftest.py
+15
-3
15 additions, 3 deletions
test/conftest.py
test/model/test_tflow.py
+3
-0
3 additions, 0 deletions
test/model/test_tflow.py
test/model/test_torch.py
+3
-0
3 additions, 0 deletions
test/model/test_torch.py
with
21 additions
and
3 deletions
test/conftest.py
+
15
−
3
View file @
5fe5ed7c
...
...
@@ -20,17 +20,29 @@
import
pytest
def
pytest_addoption
(
parser
)
->
None
:
# type: ignore
"""
Add
a
'
--fulltest
'
option to the pytest commandline.
"""
def
pytest_addoption
(
parser
)
->
None
:
"""
Add
some custom
option
s
to the pytest commandline.
"""
parser
.
addoption
(
"
--fulltest
"
,
action
=
"
store_true
"
,
default
=
False
,
help
=
"
--fulltest: run all test scenarios in
'
test_main.py
'"
,
)
parser
.
addoption
(
"
--cpu-only
"
,
action
=
"
store_true
"
,
default
=
False
,
help
=
"
--cpu-only: disable the use of GPU devices in tests
"
,
)
@pytest.fixture
(
name
=
"
fulltest
"
)
def
fulltest_fixture
(
request
)
->
bool
:
# type: ignore
def
fulltest_fixture
(
request
)
->
bool
:
"""
Gather the
'
--fulltest
'
option
'
s value.
"""
return
bool
(
request
.
config
.
getoption
(
"
--fulltest
"
))
@pytest.fixture
(
name
=
"
cpu_only
"
)
def
cpu_only_fixture
(
request
)
->
bool
:
"""
Gather the
'
--cpu-only
'
option
'
s value.
"""
return
bool
(
request
.
config
.
getoption
(
"
--cpu-only
"
))
This diff is collapsed.
Click to expand it.
test/model/test_tflow.py
+
3
−
0
View file @
5fe5ed7c
...
...
@@ -159,8 +159,11 @@ class TensorflowTestCase(ModelTestCase):
def
fixture_test_case
(
kind
:
Literal
[
"
MLP
"
,
"
MLP-tune
"
,
"
RNN
"
,
"
CNN
"
],
device
:
Literal
[
"
CPU
"
,
"
GPU
"
],
cpu_only
:
bool
,
)
->
TensorflowTestCase
:
"""
Fixture to access a TensorflowTestCase.
"""
if
cpu_only
and
(
device
==
"
GPU
"
):
pytest
.
skip
(
reason
=
"
--cpu-only mode
"
)
return
TensorflowTestCase
(
kind
,
device
)
...
...
This diff is collapsed.
Click to expand it.
test/model/test_torch.py
+
3
−
0
View file @
5fe5ed7c
...
...
@@ -176,8 +176,11 @@ class TorchTestCase(ModelTestCase):
def
fixture_test_case
(
kind
:
Literal
[
"
MLP
"
,
"
MLP-tune
"
,
"
RNN
"
,
"
CNN
"
],
device
:
Literal
[
"
CPU
"
,
"
GPU
"
],
cpu_only
:
bool
,
)
->
TorchTestCase
:
"""
Fixture to access a TorchTestCase.
"""
if
cpu_only
and
device
==
"
GPU
"
:
pytest
.
skip
(
reason
=
"
--cpu-only mode
"
)
return
TorchTestCase
(
kind
,
device
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment