kiwicom / pytest-recording

A pytest plugin that allows recording network interactions via VCR.py
MIT License
425 stars 34 forks source link

TypeError when using network blocking with address as bytes #55

Closed Stranger6667 closed 4 years ago

Stranger6667 commented 4 years ago
pattern = '(127.0.0.2)', string = b'127.0.0.1', flags = 0

    def match(pattern, string, flags=0):
        """Try to apply the pattern at the start of the string, returning
        a Match object, or None if no match was found."""
>       return _compile(pattern, flags).match(string)
E       TypeError: cannot use a string pattern on a bytes-like object

bytearray is also a possible type

And the code to trigger:

with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
    sock.connect((b"127.0.0.1", 80))