old_contents: def test_service_running(Service):
      service = Service('znc')
      assert service.is_running
  
  
  def test_socket_listening(Socket):
      socket = Socket('tcp://127.0.0.1:6666')
      assert socket.is_listening
  
new_contents: from testinfra.utils.ansible_runner import AnsibleRunner
  
  testinfra_hosts = AnsibleRunner('.molecule/ansible_inventory').get_hosts('all')
  
  
  def test_service_enabled(Service):
      service = Service('znc')
      assert service.is_enabled
  
  
  def test_service_running(Service):
      service = Service('znc')
      assert service.is_running
  
  
  def test_socket_listening_ipv4(Socket):
      socket = Socket('tcp://0.0.0.0:6666')
      assert socket.is_listening
  
  
  def test_socket_listening_ipv6(Socket):
      socket = Socket('tcp://:::6666')
      assert not socket.is_listening
  
subject: Tweak the infratest a bit