Skip to content

Commit

Permalink
Add unit test to ensure that subclasses are still blocked.
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewwardrop authored and miketheman committed Feb 10, 2021
1 parent b37e343 commit abc3016
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/test_socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,3 +210,21 @@ def test_socket2():
""")
result = testdir.runpytest("--verbose", "--disable-socket")
result.assert_outcomes(1, 0, 2)


def test_socket_subclass_is_still_blocked(testdir):
testdir.makepyfile("""
import pytest
import pytest_socket
import socket
@pytest.mark.disable_socket
def test_subclass_is_still_blocked():
class MySocket(socket.socket):
pass
MySocket(socket.AF_INET, socket.SOCK_STREAM)
""")
result = testdir.runpytest("--verbose")
assert_socket_blocked(result)

0 comments on commit abc3016

Please sign in to comment.