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
361013fe
Commit
361013fe
authored
Dec 14, 2018
by
Jason R. Coombs
Committed by
GitHub
Dec 14, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1544 from kanikas3/added-unittest-download-git
added unittest for _download_git
parents
1c1c9152
b431aef3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
0 deletions
+40
-0
changelog.d/1544.change.rst
changelog.d/1544.change.rst
+1
-0
setuptools/tests/test_packageindex.py
setuptools/tests/test_packageindex.py
+39
-0
No files found.
changelog.d/1544.change.rst
0 → 100644
View file @
361013fe
Added tests for PackageIndex.download (for git URLs).
setuptools/tests/test_packageindex.py
View file @
361013fe
...
...
@@ -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
...
...
@@ -223,6 +224,44 @@ class TestPackageIndex:
assert
dists
[
0
].
version
==
''
assert
dists
[
1
].
version
==
vc
def
test_download_git_with_rev
(
self
,
tmpdir
):
url
=
'git+https://github.example/group/project@master#egg=foo'
index
=
setuptools
.
package_index
.
PackageIndex
()
with
mock
.
patch
(
"os.system"
)
as
os_system_mock
:
result
=
index
.
download
(
url
,
str
(
tmpdir
))
os_system_mock
.
assert_called
()
expected_dir
=
str
(
tmpdir
/
'project@master'
)
expected
=
(
'git clone --quiet '
'https://github.example/group/project {expected_dir}'
).
format
(
**
locals
())
first_call_args
=
os_system_mock
.
call_args_list
[
0
][
0
]
assert
first_call_args
==
(
expected
,)
tmpl
=
'(cd {expected_dir} && git checkout --quiet master)'
expected
=
tmpl
.
format
(
**
locals
())
assert
os_system_mock
.
call_args_list
[
1
][
0
]
==
(
expected
,)
assert
result
==
expected_dir
def
test_download_git_no_rev
(
self
,
tmpdir
):
url
=
'git+https://github.example/group/project#egg=foo'
index
=
setuptools
.
package_index
.
PackageIndex
()
with
mock
.
patch
(
"os.system"
)
as
os_system_mock
:
result
=
index
.
download
(
url
,
str
(
tmpdir
))
os_system_mock
.
assert_called
()
expected_dir
=
str
(
tmpdir
/
'project'
)
expected
=
(
'git clone --quiet '
'https://github.example/group/project {expected_dir}'
).
format
(
**
locals
())
os_system_mock
.
assert_called_once_with
(
expected
)
class
TestContentCheckers
:
def
test_md5
(
self
):
...
...
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