Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
swh-core
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
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
Show more breadcrumbs
Platform
Development
swh-core
Commits
b26a668e
Commit
b26a668e
authored
1 year ago
by
David Douard
Browse files
Options
Downloads
Patches
Plain Diff
tests: get rid of single-param parametrized tests
parent
89d48572
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!359
Make `swh db init` command work *properly* with the --dbname option
Pipeline
#3488
passed
1 year ago
Stage: external
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
swh/core/db/tests/test_db_utils.py
+10
-12
10 additions, 12 deletions
swh/core/db/tests/test_db_utils.py
with
10 additions
and
12 deletions
swh/core/db/tests/test_db_utils.py
+
10
−
12
View file @
b26a668e
...
...
@@ -24,8 +24,8 @@ from swh.core.db.db_utils import (
from
.test_cli
import
craft_conninfo
@pytest.mark.parametrize
(
"
module
"
,
[
"
test.cli
"
])
def
test_get_sql_for_package
(
mock_import_swhmodule
,
module
):
def
test_get_sql_for_package
(
mock_import_swhmodule
):
module
=
"
test.cli
"
files
=
get_sql_for_package
(
module
)
assert
files
assert
[
f
.
name
for
f
in
files
]
==
[
...
...
@@ -37,8 +37,7 @@ def test_get_sql_for_package(mock_import_swhmodule, module):
]
@pytest.mark.parametrize
(
"
module
"
,
[
"
test.cli
"
])
def
test_db_utils_versions
(
cli_runner
,
postgresql
,
mock_import_swhmodule
,
module
):
def
test_db_utils_versions
(
cli_runner
,
postgresql
,
mock_import_swhmodule
):
"""
Check get_database_info, swh_db_versions and swh_db_module work ok
This test checks db versions is properly initialized by the cli db init
...
...
@@ -46,6 +45,7 @@ def test_db_utils_versions(cli_runner, postgresql, mock_import_swhmodule, module
mock_import_swhmodule should set the initial version to 3.
"""
module
=
"
test.cli
"
conninfo
=
craft_conninfo
(
postgresql
)
result
=
cli_runner
.
invoke
(
swhdb
,
[
"
init-admin
"
,
module
,
"
--dbname
"
,
conninfo
])
assert
result
.
exit_code
==
0
,
f
"
Unexpected output:
{
result
.
output
}
"
...
...
@@ -92,11 +92,9 @@ def test_db_utils_versions(cli_runner, postgresql, mock_import_swhmodule, module
assert
(
now
()
-
ts
)
<
timedelta
(
seconds
=
1
)
@pytest.mark.parametrize
(
"
module
"
,
[
"
test.cli
"
])
def
test_db_utils_upgrade
(
cli_runner
,
postgresql
,
mock_import_swhmodule
,
module
,
datadir
):
def
test_db_utils_upgrade
(
cli_runner
,
postgresql
,
mock_import_swhmodule
,
datadir
):
"""
Check swh_db_upgrade
"""
module
=
"
test.cli
"
conninfo
=
craft_conninfo
(
postgresql
)
result
=
cli_runner
.
invoke
(
swhdb
,
[
"
init-admin
"
,
module
,
"
--dbname
"
,
conninfo
])
assert
result
.
exit_code
==
0
,
f
"
Unexpected output:
{
result
.
output
}
"
...
...
@@ -133,11 +131,11 @@ def test_db_utils_upgrade(
assert
not
result
@pytest.mark.parametrize
(
"
module
"
,
[
"
test.cli
"
])
def
test_db_utils_swh_db_upgrade_sanity_checks
(
cli_runner
,
postgresql
,
mock_import_swhmodule
,
module
,
datadir
cli_runner
,
postgresql
,
mock_import_swhmodule
,
datadir
):
"""
Check swh_db_upgrade
"""
module
=
"
test.cli
"
conninfo
=
craft_conninfo
(
postgresql
)
result
=
cli_runner
.
invoke
(
swhdb
,
[
"
init-admin
"
,
module
,
"
--dbname
"
,
conninfo
])
assert
result
.
exit_code
==
0
,
f
"
Unexpected output:
{
result
.
output
}
"
...
...
@@ -178,10 +176,10 @@ def test_db_utils_swh_db_upgrade_sanity_checks(
swh_db_upgrade
(
conninfo
,
module
)
@pytest.mark.parametrize
(
"
module
"
,
[
"
test.cli
"
])
@pytest.mark.parametrize
(
"
flavor
"
,
[
None
,
"
default
"
,
"
flavorA
"
,
"
flavorB
"
])
def
test_db_utils_flavor
(
cli_runner
,
postgresql
,
mock_import_swhmodule
,
module
,
flavor
):
def
test_db_utils_flavor
(
cli_runner
,
postgresql
,
mock_import_swhmodule
,
flavor
):
"""
Check populate_database_for_package handle db flavor properly
"""
module
=
"
test.cli
"
conninfo
=
craft_conninfo
(
postgresql
)
result
=
cli_runner
.
invoke
(
swhdb
,
[
"
init-admin
"
,
module
,
"
--dbname
"
,
conninfo
])
assert
result
.
exit_code
==
0
,
f
"
Unexpected output:
{
result
.
output
}
"
...
...
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