Skip to content

Commit 6877c81

Browse files
committed
Tests pass when ssl module is not included in the Python distribution
1 parent 367cd96 commit 6877c81

File tree

4 files changed

+24
-24
lines changed

4 files changed

+24
-24
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
"""json is the same name as a stdlib module."""
2+
3+
4+
class JSONDecoder:
5+
"""Do things with json."""
6+
7+
def decode(self, s):
8+
"""Decode a string."""
9+
return s

tests/python/pystdlib/stdlib/myssl.py renamed to tests/python/pystdlib/stdlib/myjson.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
"""This is a docstring."""
22

3-
from ssl import SSLContext
3+
from json import JSONDecoder
44

55

6-
class MySSLContext(SSLContext):
6+
class MyJSONDecoder(JSONDecoder):
77
"""This is a class."""
88

99
def my_method(self):

tests/python/pystdlib/stdlib/ssl.py

Lines changed: 0 additions & 9 deletions
This file was deleted.

tests/python/test_pyintegration.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,30 +1252,30 @@ def built(self, builder):
12521252
builder("pystdlib")
12531253

12541254
def test_integration(self, parse):
1255-
ssl_file = parse("_build/html/autoapi/ssl/index.html")
1255+
json_file = parse("_build/html/autoapi/json/index.html")
12561256

1257-
ssl_mod = ssl_file.find(id="ssl")
1258-
assert "ssl is the same name" in ssl_mod.parent.text
1257+
json_mod = json_file.find(id="json")
1258+
assert "json is the same name" in json_mod.parent.text
12591259

1260-
assert ssl_file.find(id="ssl.SSLContext")
1261-
wrap_socket = ssl_file.find(id="ssl.SSLContext.wrap_socket")
1262-
assert wrap_socket
1263-
wrap_docstring = wrap_socket.parent.find("dd").text.strip()
1264-
assert wrap_docstring == "Wrap a socket."
1260+
assert json_file.find(id="json.JSONDecoder")
1261+
decode = json_file.find(id="json.JSONDecoder.decode")
1262+
assert decode
1263+
wrap_docstring = decode.parent.find("dd").text.strip()
1264+
assert wrap_docstring == "Decode a string."
12651265

1266-
myssl_file = parse("_build/html/autoapi/myssl/index.html")
1266+
myjson_file = parse("_build/html/autoapi/myjson/index.html")
12671267

12681268
# Find members that are not inherited from local standard library classes.
1269-
ctx = myssl_file.find(id="myssl.MySSLContext")
1269+
ctx = myjson_file.find(id="myjson.MyJSONDecoder")
12701270
assert ctx
1271-
meth = myssl_file.find(id="myssl.MySSLContext.my_method")
1271+
meth = myjson_file.find(id="myjson.MyJSONDecoder.my_method")
12721272
assert meth
12731273
meth_docstring = meth.parent.find("dd").text.strip()
12741274
assert meth_docstring == "This is a method."
12751275

12761276
# Find members that are inherited from local standard library classes.
1277-
wrap_socket = myssl_file.find(id="myssl.MySSLContext.wrap_socket")
1278-
assert not wrap_socket
1277+
decode = myjson_file.find(id="myjson.MyJSONDecoder.decode")
1278+
assert decode
12791279

12801280
myast_file = parse("_build/html/autoapi/myast/index.html")
12811281

0 commit comments

Comments
 (0)