cargo test ipv4 ... runs the ipv4 tests twice. Once through the main ipv4 file and then again because of the pub mod ipv4_tests inside the ipv6 test file. The import is only used to access constants. It may be worth to have duplicate constants if no other test de-duplication solution exists.