FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
GitPython/test/deprecation/lib.py at main · gitpython-developers/GitPython · GitHub
gitpython-developers
GitPython
Repository navigation
Code
Issues
7
(7)
Pull requests
3
(3)
Discussions
Actions
Security and quality
41
(41)
Insights
Expand file tree
Breadcrumbs
GitPython
/
test
/
deprecation
/
lib.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
27 lines (19 loc) · 883 Bytes
Breadcrumbs
GitPython
/
test
/
deprecation
/
lib.py
Copy path
File metadata and controls
27 lines (19 loc) · 883 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# This module is part of GitPython and is released under the
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/
"""Support library for deprecation tests."""
__all__
=
[
"assert_no_deprecation_warning"
,
"suppress_deprecation_warning"
]
import
contextlib
import
warnings
from
typing
import
Generator
@
contextlib
.
contextmanager
def
assert_no_deprecation_warning
()
->
Generator
[
None
,
None
,
None
]:
"""Context manager to assert that code does not issue any deprecation warnings."""
with
warnings
.
catch_warnings
():
warnings
.
simplefilter
(
"error"
,
DeprecationWarning
)
warnings
.
simplefilter
(
"error"
,
PendingDeprecationWarning
)
yield
@
contextlib
.
contextmanager
def
suppress_deprecation_warning
()
->
Generator
[
None
,
None
,
None
]:
with
warnings
.
catch_warnings
():
warnings
.
simplefilter
(
"ignore"
,
DeprecationWarning
)
yield
Back
|
FazBrowse Home
|
New Git URL