Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
Adam Mercer
Koji Packager
Commits
ca5e3403
Commit
ca5e3403
authored
May 16, 2019
by
Adam Mercer
💬
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'test-updates' into 'master'
Test updates See merge request
packaging/koji-packager!7
parents
18449167
f99c14c5
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
22 deletions
+23
-22
gwkoji/__init__.py
gwkoji/__init__.py
+1
-1
gwkoji/tests/test_build.py
gwkoji/tests/test_build.py
+5
-5
gwkoji/tests/test_options.py
gwkoji/tests/test_options.py
+5
-5
gwkoji/tests/test_utils.py
gwkoji/tests/test_utils.py
+8
-7
gwkoji/utils.py
gwkoji/utils.py
+4
-4
No files found.
gwkoji/__init__.py
View file @
ca5e3403
...
...
@@ -19,4 +19,4 @@
"""Python library for interacting with the Koji RPM build system
"""
__version__
=
"
0.1.0
"
__version__
=
'
0.1.0
'
gwkoji/tests/test_build.py
View file @
ca5e3403
...
...
@@ -24,13 +24,13 @@ from unittest import mock
from
..
import
build
as
gwkoji_build
@
mock
.
patch
(
"
gwkoji.build.find_executable
"
,
return_value
=
"
/usr/bin/spectool
"
)
@
mock
.
patch
(
"
gwkoji.build.logged_check_call
"
)
@
mock
.
patch
(
'
gwkoji.build.find_executable
'
,
return_value
=
'
/usr/bin/spectool
'
)
@
mock
.
patch
(
'
gwkoji.build.logged_check_call
'
)
def
test_download_spec_sources
(
call
,
_
):
gwkoji_build
.
download_spec_sources
(
"
test.spec
"
,
"
outdir
"
,
logger
=
1
)
gwkoji_build
.
download_spec_sources
(
'
test.spec
'
,
'
outdir
'
,
logger
=
1
)
call
.
assert_called_once_with
(
[
"
/usr/bin/spectool
"
,
"
--get-files
"
,
"
--directory
"
,
"
outdir
"
,
"
test.spec
"
],
[
'
/usr/bin/spectool
'
,
'
--get-files
'
,
'
--directory
'
,
'
outdir
'
,
'
test.spec
'
],
logger
=
1
,
)
...
...
gwkoji/tests/test_options.py
View file @
ca5e3403
...
...
@@ -28,15 +28,15 @@ import pytest
from
..
import
options
as
gwkoji_options
@
mock
.
patch
.
object
(
sys
,
"
argv
"
,
[
"
gwkoji-packager
"
,
"
test.spec
"
,
"
--spec
"
])
@
mock
.
patch
.
object
(
sys
,
'
argv
'
,
[
'
gwkoji-packager
'
,
'
test.spec
'
,
'
--spec
'
])
def
test_parse_options
():
args
=
gwkoji_options
.
parse_options
()
assert
args
.
source
==
Path
(
"
test.spec
"
)
assert
args
.
source_type
==
"
spec
"
assert
args
.
source
==
Path
(
'
test.spec
'
)
assert
args
.
source_type
==
'
spec
'
@
mock
.
patch
.
object
(
sys
,
"
argv
"
,
[
"
gwkoji-packager
"
,
"
test.spec
"
,
"
--spec
"
,
"
--tarball
"
])
@
mock
.
patch
.
object
(
sys
,
'
argv
'
,
[
'
gwkoji-packager
'
,
'
test.spec
'
,
'
--spec
'
,
'
--tarball
'
])
def
test_parse_options_exclusive_source_type
():
with
pytest
.
raises
(
SystemExit
):
gwkoji_options
.
parse_options
()
gwkoji/tests/test_utils.py
View file @
ca5e3403
...
...
@@ -25,12 +25,13 @@ from .. import utils as gwkoji_utils
@
pytest
.
mark
.
parametrize
(
"source, type_"
,
[
(
"git+https://git.ligo.org/albert/gr"
,
"git"
),
(
"mypackage.spec"
,
"spec"
),
(
"mypackage.src.rpm"
,
"srcrpm"
),
(
"mypackage.tar"
,
"tarball"
),
(
"mypackage.tar.gz"
,
"tarball"
),
(
"mypackage.tar.xz"
,
"tarball"
),
(
'git+https://git.ligo.org/albert/gr#origin/rhel'
,
'git'
),
(
'mypackage.spec'
,
'spec'
),
(
'mypackage.src.rpm'
,
'srcrpm'
),
(
'mypackage.tar'
,
'tarball'
),
(
'mypackage.tar.bz2'
,
'tarball'
),
(
'mypackage.tar.gz'
,
'tarball'
),
(
'mypackage.tar.xz'
,
'tarball'
),
])
def
test_source_type
(
source
,
type_
):
assert
gwkoji_utils
.
source_type
(
source
)
==
type_
...
...
@@ -38,4 +39,4 @@ def test_source_type(source, type_):
def
test_source_type_error
():
with
pytest
.
raises
(
ValueError
):
gwkoji_utils
.
source_type
(
"
blah
"
)
gwkoji_utils
.
source_type
(
'
blah
'
)
gwkoji/utils.py
View file @
ca5e3403
...
...
@@ -77,13 +77,13 @@ def source_type(source):
"""
source
=
pathlib
.
Path
(
source
)
name
=
source
.
name
if
name
.
endswith
(
"
.src.rpm
"
):
if
name
.
endswith
(
'
.src.rpm
'
):
return
'srcrpm'
if
name
.
endswith
(
"
.spec
"
):
if
name
.
endswith
(
'
.spec
'
):
return
'spec'
if
name
.
endswith
(
"
.tar
"
)
or
source
.
stem
.
endswith
(
"
.tar
"
):
if
name
.
endswith
(
'
.tar
'
)
or
source
.
stem
.
endswith
(
'
.tar
'
):
return
'tarball'
if
str
(
source
).
startswith
((
"
git+https
"
,
"
git+ssh
"
)):
if
str
(
source
).
startswith
((
'
git+https
'
,
'
git+ssh
'
)):
return
'git'
raise
ValueError
(
"failed to determine source type for '{0}'"
.
format
(
source
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment