pytest-socket
pytest-socket copied to clipboard
feat(allow_hosts): add support for hostname resolution
Hey, thanks for the nice project.
Scenario I'm attempting to solve:
- We have a service in our project we must connect to from a docker-composed application.
- The hostname is stable but not the IP address.
Somewhat similar to #73
What does this MR do
- Resolve
allowedhostnames into IPs if possible and check if added exceptions are correct IPv4 addresses - Strip strings added to the list to make sure
pytest --allow-hosts="172.18.0.2, 172.18.0.1"works
Questions
- no checks for IPv6 addresses was done, is it relevant to readd?
If type hinting is necessary or some documentation needs to be changed feel free to ask.
Code Climate has analyzed commit ee08d8eb and detected 0 issues on this pull request.
View more on Code Climate.
Any way this can get into a release? I think it would help a lot if you want to use this plugin with something like docker-compose.
please, could we upgrade this PR and #73 and get them into a release? I could help if you give me instructions.
Closed via #189