curl-impersonate: A special build of curl that can impersonate Chrome & Firefox
Use configurable tcpdump interface in the tests
lwthikerf5467cec11a0
diff --git a/tests/test_impersonate.py b/tests/test_impersonate.pyindex 9446b44..ffc4bbb 100644--- a/tests/test_impersonate.py+++ b/tests/test_impersonate.py@@ -214,15 +214,17 @@ class TestImpersonation:]@pytest.fixture- def tcpdump(self):+ def tcpdump(self, pytestconfig):"""Initialize a sniffer to capture curl's traffic."""+ interface = pytestconfig.getoption("capture_interface")+logging.debug(- f"Running tcpdump on interface {self.TCPDUMP_CAPTURE_INTERFACE}"+ f"Running tcpdump on interface {interface}")p = subprocess.Popen(["tcpdump", "-n",- "-i", self.TCPDUMP_CAPTURE_INTERFACE,+ "-i", interface,"-s", "0","-w", "-","-U", # Important, makes tcpdump unbuffered@@ -282,7 +284,7 @@ class TestImpersonation:"""for ts, buf in dpkt.pcap.Reader(io.BytesIO(pcap)):eth = dpkt.ethernet.Ethernet(buf)- if not isinstance(eth.data, dpkt.ip.IP):+ if not isinstance(eth.data, dpkt.ip.IP) and not isinstance(eth.data, dpkt.ip6.IP6):continueip = eth.dataif not isinstance(ip.data, dpkt.tcp.TCP):