Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
a0d73a14
Commit
a0d73a14
authored
Jun 21, 2019
by
Joannah Nanjekye
Committed by
Brett Cannon
Jun 21, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-30202 : Update test.test_importlib.test_abc to test find_spec() (GH-12847)
parent
f8dd77d3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
4 deletions
+18
-4
Lib/test/test_importlib/test_abc.py
Lib/test/test_importlib/test_abc.py
+17
-4
Misc/NEWS.d/next/Tests/2019-04-15-19-05-35.bpo-30202.Wt7INj.rst
...EWS.d/next/Tests/2019-04-15-19-05-35.bpo-30202.Wt7INj.rst
+1
-0
No files found.
Lib/test/test_importlib/test_abc.py
100644 → 100755
View file @
a0d73a14
...
...
@@ -357,13 +357,27 @@ class MetaPathFinderFindModuleTests:
return
MetaPathSpecFinder
()
def
test_
no_spec
(
self
):
def
test_
find_module
(
self
):
finder
=
self
.
finder
(
None
)
path
=
[
'a'
,
'b'
,
'c'
]
name
=
'blah'
with
self
.
assertWarns
(
DeprecationWarning
):
found
=
finder
.
find_module
(
name
,
path
)
self
.
assertIsNone
(
found
)
def
test_find_spec_with_explicit_target
(
self
):
loader
=
object
()
spec
=
self
.
util
.
spec_from_loader
(
'blah'
,
loader
)
finder
=
self
.
finder
(
spec
)
found
=
finder
.
find_spec
(
'blah'
,
'blah'
,
None
)
self
.
assertEqual
(
found
,
spec
)
def
test_no_spec
(
self
):
finder
=
self
.
finder
(
None
)
path
=
[
'a'
,
'b'
,
'c'
]
name
=
'blah'
found
=
finder
.
find_spec
(
name
,
path
,
None
)
self
.
assertIsNone
(
found
)
self
.
assertEqual
(
name
,
finder
.
called_for
[
0
])
self
.
assertEqual
(
path
,
finder
.
called_for
[
1
])
...
...
@@ -371,9 +385,8 @@ class MetaPathFinderFindModuleTests:
loader
=
object
()
spec
=
self
.
util
.
spec_from_loader
(
'blah'
,
loader
)
finder
=
self
.
finder
(
spec
)
with
self
.
assertWarns
(
DeprecationWarning
):
found
=
finder
.
find_module
(
'blah'
,
None
)
self
.
assertIs
(
found
,
spec
.
loader
)
found
=
finder
.
find_spec
(
'blah'
,
None
)
self
.
assertIs
(
found
,
spec
)
(
Frozen_MPFFindModuleTests
,
...
...
Misc/NEWS.d/next/Tests/2019-04-15-19-05-35.bpo-30202.Wt7INj.rst
0 → 100644
View file @
a0d73a14
Update ``test.test_importlib.test_abc`` to test ``find_spec()``.
\ No newline at end of file
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