Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
setuptools
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
setuptools
Commits
9fad9937
Commit
9fad9937
authored
Oct 27, 2018
by
Kanika Sabharwal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added unittest for _download_git
parent
56a7c443
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
0 deletions
+36
-0
setuptools/tests/test_packageindex.py
setuptools/tests/test_packageindex.py
+36
-0
No files found.
setuptools/tests/test_packageindex.py
View file @
9fad9937
...
...
@@ -6,6 +6,7 @@ import distutils.errors
from
setuptools.extern
import
six
from
setuptools.extern.six.moves
import
urllib
,
http_client
import
mock
import
pkg_resources
import
setuptools.package_index
...
...
@@ -224,6 +225,41 @@ class TestPackageIndex:
assert
dists
[
1
].
version
==
vc
def
test_download_git
(
self
):
index
=
setuptools
.
package_index
.
PackageIndex
(
hosts
=
(
'www.example.com'
,)
)
index
.
_vcs_split_rev_from_url
=
mock
.
Mock
()
url
=
'https://example.com/bar'
rev
=
'2995'
index
.
_vcs_split_rev_from_url
.
return_value
=
(
url
,
rev
)
filename
=
"somefile.py"
with
mock
.
patch
(
"os.system"
)
as
os_system_mock
:
result
=
index
.
_download_git
(
url
,
filename
)
os_system_mock
.
assert_called
()
assert
os_system_mock
.
call_args_list
[
0
][
0
]
\
==
(
"git clone --quiet %s %s"
%
(
url
,
filename
),
)
assert
os_system_mock
.
call_args_list
[
1
][
0
]
\
==
(
"(cd %s && git checkout --quiet %s)"
%
(
filename
,
rev
),
)
assert
result
==
filename
index
.
_vcs_split_rev_from_url
.
return_value
=
(
url
,
None
)
with
mock
.
patch
(
"os.system"
)
as
os_system_mock
:
index
.
_download_git
(
url
,
filename
)
os_system_mock
.
assert_called_once_with
(
"git clone --quiet %s %s"
%
(
url
,
filename
))
class
TestContentCheckers
:
def
test_md5
(
self
):
checker
=
setuptools
.
package_index
.
HashChecker
.
from_url
(
...
...
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