Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
deepdraw
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
medai
software
deepdraw
Commits
950f32f5
Commit
950f32f5
authored
4 years ago
by
André Anjos
Browse files
Options
Downloads
Patches
Plain Diff
[test] Add missing conftest for pytest
parent
f7194494
No related branches found
No related tags found
1 merge request
!16
Use pytest instead of nose
Pipeline
#45681
failed
4 years ago
Stage: build
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bob/ip/binseg/test/conftest.py
+47
-0
47 additions, 0 deletions
bob/ip/binseg/test/conftest.py
with
47 additions
and
0 deletions
bob/ip/binseg/test/conftest.py
0 → 100644
+
47
−
0
View file @
950f32f5
#!/usr/bin/env python
# coding=utf-8
import
pytest
import
bob.extension
def
pytest_configure
(
config
):
"""
This function is run once for pytest setup
"""
config
.
addinivalue_line
(
"
markers
"
,
"
skip_if_rc_var_not_set(name): this mark skips the test if a certain
"
"
~/.bobrc variable is not set
"
,
)
config
.
addinivalue_line
(
"
markers
"
,
"
slow: this mark indicates slow tests
"
)
def
pytest_runtest_setup
(
item
):
"""
This function is run for every test candidate in this directory
The test is run if this function returns ``None``. To skip a test, call
``pytest.skip()``, specifying a reason.
"""
# iterates over all markers for the item being examined, get the first
# argument and accumulate these names
rc_names
=
[
mark
.
args
[
0
]
for
mark
in
item
.
iter_markers
(
name
=
"
skip_if_rc_var_not_set
"
)
]
# checks all names mentioned are set in ~/.bobrc, otherwise, skip the test
if
rc_names
:
missing
=
[
k
for
k
in
rc_names
if
(
k
not
in
bob
.
extension
.
rc
)]
if
any
(
missing
):
pytest
.
skip
(
f
"
Test skipped because
{
'
,
'
.
join
(
missing
)
}
are **not**
"
f
"
set in ~/.bobrc
"
)
def
rc_variable_set
(
name
):
pytest
.
mark
.
skipif
(
name
not
in
bob
.
extension
.
rc
,
reason
=
f
"
Bob
'
s RC variable
'
{
name
}
'
is not set
"
,
)
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