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
7edce734
Commit
7edce734
authored
Jul 08, 2018
by
Dustin Ingram
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tests for deprecation warnings
parent
a91c5719
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
86 additions
and
0 deletions
+86
-0
setuptools/tests/test_register.py
setuptools/tests/test_register.py
+43
-0
setuptools/tests/test_upload.py
setuptools/tests/test_upload.py
+43
-0
No files found.
setuptools/tests/test_register.py
0 → 100644
View file @
7edce734
import
mock
from
distutils
import
log
import
pytest
from
setuptools.command.register
import
register
from
setuptools.dist
import
Distribution
class
TestRegisterTest
:
def
test_warns_deprecation
(
self
):
dist
=
Distribution
()
cmd
=
register
(
dist
)
cmd
.
run_command
=
mock
.
Mock
()
cmd
.
send_metadata
=
mock
.
Mock
()
cmd
.
announce
=
mock
.
Mock
()
cmd
.
run
()
cmd
.
announce
.
assert_called_once_with
(
"WARNING: Registering is deprecated, use twine to upload instead "
"(https://pypi.org/p/twine/)"
,
log
.
WARN
)
def
test_warns_deprecation_when_raising
(
self
):
dist
=
Distribution
()
cmd
=
register
(
dist
)
cmd
.
run_command
=
mock
.
Mock
()
cmd
.
send_metadata
=
mock
.
Mock
()
cmd
.
send_metadata
.
side_effect
=
Exception
cmd
.
announce
=
mock
.
Mock
()
with
pytest
.
raises
(
Exception
):
cmd
.
run
()
cmd
.
announce
.
assert_called_once_with
(
"WARNING: Registering is deprecated, use twine to upload instead "
"(https://pypi.org/p/twine/)"
,
log
.
WARN
)
setuptools/tests/test_upload.py
0 → 100644
View file @
7edce734
import
mock
from
distutils
import
log
import
pytest
from
setuptools.command.upload
import
upload
from
setuptools.dist
import
Distribution
class
TestUploadTest
:
def
test_warns_deprecation
(
self
):
dist
=
Distribution
()
dist
.
dist_files
=
[(
mock
.
Mock
(),
mock
.
Mock
(),
mock
.
Mock
())]
cmd
=
upload
(
dist
)
cmd
.
upload_file
=
mock
.
Mock
()
cmd
.
announce
=
mock
.
Mock
()
cmd
.
run
()
cmd
.
announce
.
assert_called_once_with
(
"WARNING: Uploading via this command is deprecated, use twine to "
"upload instead (https://pypi.org/p/twine/)"
,
log
.
WARN
)
def
test_warns_deprecation_when_raising
(
self
):
dist
=
Distribution
()
dist
.
dist_files
=
[(
mock
.
Mock
(),
mock
.
Mock
(),
mock
.
Mock
())]
cmd
=
upload
(
dist
)
cmd
.
upload_file
=
mock
.
Mock
()
cmd
.
upload_file
.
side_effect
=
Exception
cmd
.
announce
=
mock
.
Mock
()
with
pytest
.
raises
(
Exception
):
cmd
.
run
()
cmd
.
announce
.
assert_called_once_with
(
"WARNING: Uploading via this command is deprecated, use twine to "
"upload instead (https://pypi.org/p/twine/)"
,
log
.
WARN
)
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