Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
diffoscope
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
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
Reproducible Builds
diffoscope
Commits
3b98ffeb
Verified
Commit
3b98ffeb
authored
8 years ago
by
Mattia Rizzolo
Browse files
Options
Downloads
Patches
Plain Diff
test: factor out a tools_missing() function
parent
c506dd2a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/comparators/test_utils.py
+7
-1
7 additions, 1 deletion
tests/comparators/test_utils.py
tests/comparators/utils.py
+4
-1
4 additions, 1 deletion
tests/comparators/utils.py
with
11 additions
and
2 deletions
tests/comparators/test_utils.py
+
7
−
1
View file @
3b98ffeb
...
...
@@ -24,7 +24,7 @@ from diffoscope.config import Config
from
diffoscope.difference
import
Difference
from
diffoscope.comparators.utils
import
Command
from
utils
import
skip_unless_tools_exist
,
data
,
load_fixture
from
utils
import
tools_missing
,
skip_unless_tools_exist
,
data
,
load_fixture
try
:
import
tlsh
# noqa
...
...
@@ -36,6 +36,12 @@ fuzzy_tar1 = load_fixture(data('fuzzy1.tar'))
fuzzy_tar2
=
load_fixture
(
data
(
'
fuzzy2.tar
'
))
fuzzy_tar3
=
load_fixture
(
data
(
'
fuzzy3.tar
'
))
def
test_tools_missing
():
assert
tools_missing
()
is
True
assert
tools_missing
(
'
/missing
'
)
is
True
for
x
in
[
'
cat
'
,
'
sh
'
]:
assert
tools_missing
(
x
)
is
False
@skip_unless_tools_exist
()
def
test_skip_unless_tools_exist_empty
():
pytest
.
xfail
(
"
Test should always be skipped
"
)
...
...
This diff is collapsed.
Click to expand it.
tests/comparators/utils.py
+
4
−
1
View file @
3b98ffeb
...
...
@@ -36,9 +36,12 @@ from diffoscope.comparators.binary import FilesystemFile, NonExistingFile
def
set_locale
():
diffoscope
.
set_locale
()
def
tools_missing
(
*
required
):
return
not
required
or
any
(
find_executable
(
x
)
is
None
for
x
in
required
)
def
skip_unless_tools_exist
(
*
required
):
return
pytest
.
mark
.
skipif
(
not
required
or
any
(
find_executable
(
x
)
is
None
for
x
in
required
),
tools_missing
(
*
required
),
reason
=
"
requires {}
"
.
format
(
"
and
"
.
join
(
required
)),
)
...
...
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