Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
workspaces
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
Model registry
Operate
Environments
Terraform modules
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ssa
workspaces
Merge requests
!1036
make productfectcher use default threads capo property
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
make productfectcher use default threads capo property
productfetcher_tweaks
into
main
Overview
0
Commits
4
Pipelines
4
Changes
1
Merged
Charlotte Hausman
requested to merge
productfetcher_tweaks
into
main
2 years ago
Overview
0
Commits
4
Pipelines
4
Changes
1
Expand
0
0
Merge request reports
Viewing commit
54261ade
Prev
Next
Show latest version
1 file
+
32
−
29
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
54261ade
fix test
· 54261ade
Charlotte Hausman
authored
2 years ago
apps/cli/executables/pexable/productfetcher/tests/test_product_fetcher.py
+
32
−
29
Options
@@ -21,6 +21,7 @@
from
pathlib
import
Path
from
typing
import
List
,
Union
from
unittest.mock
import
patch
import
pytest
from
productfetcher.fetchers
import
DryRunFakeFileFetcher
,
ForceMode
@@ -117,32 +118,34 @@ def test_argument_parsing(capsys):
:param capsys:
:return:
"""
# ensure that various combinations do not work
with
pytest
.
raises
(
SystemExit
):
# must have an SPL or a file
FetchContext
.
parse_commandline
([])
# check the dry run value
fc
=
FetchContext
.
parse_commandline
([
CLIParam
.
DRY
.
value
,
CLIParam
.
FILE
.
value
,
"
foo
"
])
assert
fc
.
dry_run
fc
=
FetchContext
.
parse_commandline
([
CLIParam
.
FILE
.
value
,
"
foo
"
])
assert
not
fc
.
dry_run
# check the force value
fc
=
FetchContext
.
parse_commandline
([
CLIParam
.
FORCE
.
value
,
CLIParam
.
FILE
.
value
,
"
foo
"
])
assert
fc
.
force
==
ForceMode
.
FORCE
fc
=
FetchContext
.
parse_commandline
([
CLIParam
.
FILE
.
value
,
"
foo
"
])
assert
fc
.
force
==
ForceMode
.
NORMAL
fc
=
FetchContext
.
parse_commandline
([
CLIParam
.
FILE
.
value
,
"
foo
"
])
assert
isinstance
(
fc
.
locators
[
0
],
FileLocator
)
assert
fc
.
locators
[
0
].
file
==
Path
(
"
foo
"
)
fc
=
FetchContext
.
parse_commandline
([
CLIParam
.
SPL
.
value
,
"
uid://this/is/a/fakesy
"
])
assert
isinstance
(
fc
.
locators
[
0
],
ServiceLocator
)
assert
fc
.
locators
[
0
].
spl
==
"
uid://this/is/a/fakesy
"
fc
=
FetchContext
.
parse_commandline
([
CLIParam
.
FILE
.
value
,
"
foo
"
,
CLIParam
.
CONCURRENCY
.
value
,
"
732
"
])
assert
fc
.
concurrency
==
732
capsys
.
readouterr
()
with
patch
(
"
productfetcher.product_fetcher.CapoConfig
"
)
as
mocked_capo
:
mocked_capo
.
return_value
.
settings
.
return_value
.
defaultThreadsPerHost
=
1
# ensure that various combinations do not work
with
pytest
.
raises
(
SystemExit
):
# must have an SPL or a file
FetchContext
.
parse_commandline
([])
# check the dry run value
fc
=
FetchContext
.
parse_commandline
([
CLIParam
.
DRY
.
value
,
CLIParam
.
FILE
.
value
,
"
foo
"
])
assert
fc
.
dry_run
fc
=
FetchContext
.
parse_commandline
([
CLIParam
.
FILE
.
value
,
"
foo
"
])
assert
not
fc
.
dry_run
# check the force value
fc
=
FetchContext
.
parse_commandline
([
CLIParam
.
FORCE
.
value
,
CLIParam
.
FILE
.
value
,
"
foo
"
])
assert
fc
.
force
==
ForceMode
.
FORCE
fc
=
FetchContext
.
parse_commandline
([
CLIParam
.
FILE
.
value
,
"
foo
"
])
assert
fc
.
force
==
ForceMode
.
NORMAL
fc
=
FetchContext
.
parse_commandline
([
CLIParam
.
FILE
.
value
,
"
foo
"
])
assert
isinstance
(
fc
.
locators
[
0
],
FileLocator
)
assert
fc
.
locators
[
0
].
file
==
Path
(
"
foo
"
)
fc
=
FetchContext
.
parse_commandline
([
CLIParam
.
SPL
.
value
,
"
uid://this/is/a/fakesy
"
])
assert
isinstance
(
fc
.
locators
[
0
],
ServiceLocator
)
assert
fc
.
locators
[
0
].
spl
==
"
uid://this/is/a/fakesy
"
fc
=
FetchContext
.
parse_commandline
([
CLIParam
.
FILE
.
value
,
"
foo
"
,
CLIParam
.
CONCURRENCY
.
value
,
"
732
"
])
assert
fc
.
concurrency
==
732
capsys
.
readouterr
()
Loading