-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modify tests so skipped tests are marked as such.
- Loading branch information
Ken Kundert
authored and
Ken Kundert
committed
Mar 30, 2022
1 parent
1e9744b
commit 0fabcae
Showing
3 changed files
with
75 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Add missing dependency command line options to pytest command. | ||
|
||
import os | ||
import pytest | ||
from inform import Error, Info as CmdLineOpts | ||
from shlib import Run, set_prefs | ||
set_prefs(use_inform=True) | ||
|
||
# add command line options used to signal missing dependencies to pytest | ||
def pytest_addoption(parser): | ||
#parser.addoption( | ||
# "--borg-version", action="store", default="99.99.99", help="version number of borg" | ||
#) | ||
parser.addoption( | ||
"--no-fuse", action="store_true", default=None, help="fuse is not available" | ||
) | ||
|
||
# process the command line options | ||
@pytest.fixture(scope="session") | ||
def dependency_options(request): | ||
options = CmdLineOpts() | ||
|
||
# run borg and determine its version number | ||
try: | ||
borg = Run(["borg", "--version"], modes="sOEW") | ||
except Error as e: | ||
e.report() | ||
raise SystemExit | ||
borg_version = borg.stdout | ||
borg_version = borg_version.split()[-1] | ||
borg_version = tuple(int(i) for i in borg_version.split('.')) | ||
options.borg_version = borg_version | ||
|
||
# determine whether FUSE is available | ||
# Can specify the --no-fuse command line option or set the | ||
# MISSING_DEPENDENCIES environment to 'fuse'. | ||
options.fuse_is_missing = request.config.getvalue("--no-fuse") | ||
if 'fuse' in os.environ.get('MISSING_DEPENDENCIES', '').lower().split(): | ||
options.fuse_is_missing = True | ||
|
||
return options |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters