KimiNewt/pyshark — pull request #22 by bbayles (2014-04-22 02:29:27+00:00)
Title: Start adding some tests

While hacking on this I decided I needed some tests to make sure what I've changed hasn't affected the behavior.

I grabbed a sample capture and made up some simple tests of the file capture capability. Superficial at this point, but it's a start.

During the course of testing I found that the file descriptors for the subprocess's stdout and stderr weren't being cleaned up - I fixed that in one of the commits here. If you'd rather not add these tests I can re-submit this as a separate patch.

Tests pass on Python 2.7 and 3.4 on my machine:
````
test_count_packets (pyshark.test.validate.TestFileCaptures)
Test to make sure the right number of packets are read from a known ... ok
test_ethernet (pyshark.test.validate.TestFileCaptures)
Test to make sure Ethernet fields are being read properly by comparing ... ok
test_icmp (pyshark.test.validate.TestFileCaptures)
Test to make sure ICMP fields are being read properly by comparing ... ok
test_layers (pyshark.test.validate.TestFileCaptures)
Test to make sure the correct protocols are reported for known ... ok
test_sum_lengths (pyshark.test.validate.TestFileCaptures)
Test to make sure that the right packet length is being read from ... ok

----------------------------------------------------------------------
Ran 5 tests in 2.190s

OK
````