Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
FMC DEL 1ns 4cha
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
2
Issues
2
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
FMC DEL 1ns 4cha
Commits
68ca023b
Commit
68ca023b
authored
Nov 09, 2023
by
Federico Vaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tst: allow multiple slot tests
Signed-off-by:
Federico Vaga
<
federico.vaga@cern.ch
>
parent
857520ef
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
22 deletions
+22
-22
.gitlab-ci.yml
.gitlab-ci.yml
+1
-1
conftest.py
pytest/conftest.py
+19
-8
test_fmcfd_getter_setter.py
pytest/test-00-basic/test_fmcfd_getter_setter.py
+2
-3
test_fmcfd_loop.py
pytest/test-01-functionalities/test_fmcfd_loop.py
+0
-10
No files found.
.gitlab-ci.yml
View file @
68ca023b
# SPDX-FileCopyrightText: 202
0
CERN (home.cern)
# SPDX-FileCopyrightText: 202
3
CERN (home.cern)
#
# SPDX-License-Identifier: LGPL-2.1-or-later
...
...
pytest/conftest.py
View file @
68ca023b
...
...
@@ -45,18 +45,27 @@ def fmcfd_id_from_slot(slot):
fd_id
=
int
(
f
.
read
()
.
strip
()
.
split
(
"-"
)[
1
],
16
)
return
fd_id
@
pytest
.
fixture
(
scope
=
"session"
)
def
fd_id
(
request
):
return
request
.
param
def
pytest_generate_tests
(
metafunc
):
if
"fd_id"
in
metafunc
.
fixturenames
:
metafunc
.
parametrize
(
"fd_id"
,
pytest
.
fd_id
)
@
pytest
.
fixture
(
scope
=
"function"
)
def
fmcfd
():
fd
=
FmcFineDelay
(
pytest
.
fd_id
)
def
fmcfd
(
fd_id
):
fd
=
FmcFineDelay
(
fd_id
)
for
ch
in
fd
.
chan
:
ch
.
disable
()
yield
fd
for
chan
in
fd
.
chan
:
chan
.
disable
()
def
pytest_addoption
(
parser
):
parser
.
addoption
(
"--fd-id"
,
type
=
lambda
x
:
int
(
x
,
16
),
default
=
None
,
help
=
"Fmc Fine-Delay Linux Identifier"
)
parser
.
addoption
(
"--slot"
,
type
=
valid_slot_type
,
parser
.
addoption
(
"--fd-id"
,
type
=
lambda
x
:
int
(
x
,
16
),
action
=
'append'
,
default
=
[]
,
help
=
"Fmc Fine-Delay Linux Identifier"
)
parser
.
addoption
(
"--slot"
,
type
=
valid_slot_type
,
action
=
'append'
,
default
=
None
,
help
=
"Fmc Fine-Delay absolute slot (works only for SPEC and SVEC)"
)
parser
.
addoption
(
"--channel"
,
type
=
int
,
default
=
[],
action
=
"append"
,
choices
=
range
(
FmcFineDelay
.
CHANNEL_NUMBER
),
...
...
@@ -64,12 +73,14 @@ def pytest_addoption(parser):
def
pytest_configure
(
config
):
pytest
.
fd_id
=
config
.
getoption
(
"--fd-id"
)
if
pytest
.
fd_id
is
None
:
if
len
(
pytest
.
fd_id
)
==
0
:
pytest
.
slot
=
config
.
getoption
(
"--slot"
)
if
pytest
.
slot
is
None
:
if
len
(
pytest
.
slot
)
==
0
:
print
(
"Missing argument --fd-id or --slot"
)
raise
Exception
()
pytest
.
fd_id
=
fmcfd_id_from_slot
(
pytest
.
slot
)
pytest
.
fd_id
=
[]
for
slot
in
pytest
.
slot
:
pytest
.
fd_id
.
append
(
fmcfd_id_from_slot
(
slot
))
pytest
.
channels
=
config
.
getoption
(
"--channel"
)
if
len
(
pytest
.
channels
)
==
0
:
pytest
.
channels
=
range
(
FmcFineDelay
.
CHANNEL_NUMBER
)
pytest/test-00-basic/test_fmcfd_getter_setter.py
View file @
68ca023b
...
...
@@ -10,9 +10,8 @@ from PyFmcFineDelay import FmcFineDelay, FmcFineDelayTime
@
pytest
.
fixture
(
scope
=
"function"
,
params
=
range
(
0
,
FmcFineDelay
.
CHANNEL_NUMBER
))
def
fmcfd_chan
(
request
):
fd
=
FmcFineDelay
(
pytest
.
fd_id
)
yield
fd
.
chan
[
request
.
param
]
def
fmcfd_chan
(
request
,
fmcfd
):
yield
fmcfd
.
chan
[
request
.
param
]
class
TestFmcfdGetterSetter
(
object
):
...
...
pytest/test-01-functionalities/test_fmcfd_loop.py
View file @
68ca023b
...
...
@@ -11,16 +11,6 @@ from PyFmcFineDelay import FmcFineDelay, FmcFineDelayTime
import
random
@
pytest
.
fixture
(
scope
=
"function"
)
def
fmcfd
():
fd
=
FmcFineDelay
(
pytest
.
fd_id
)
for
ch
in
fd
.
chan
:
ch
.
disable
()
yield
fd
for
ch
in
fd
.
chan
:
ch
.
disable
()
@
pytest
.
fixture
(
scope
=
"function"
,
params
=
pytest
.
channels
)
def
fmcfd_chan
(
request
,
fmcfd
):
yield
fmcfd
.
chan
[
request
.
param
]
...
...
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