Skip to content

Fix warning "provided hosts list is empty, only localhost is available"#1700

Merged
daall merged 1 commit intosonic-net:masterfrom
wangxin:localhost-inventory-warning
May 27, 2020
Merged

Fix warning "provided hosts list is empty, only localhost is available"#1700
daall merged 1 commit intosonic-net:masterfrom
wangxin:localhost-inventory-warning

Conversation

@wangxin
Copy link
Copy Markdown
Collaborator

@wangxin wangxin commented May 26, 2020

Description of PR

Summary:
Fixes # (issue)

When run pytest scripts, a warning is always shown:

test_example.py::test_case1
  /usr/local/lib/python2.7/dist-packages/pytest_ansible/module_dispatcher/v28.py:70: UserWarning: provided hosts list is empty, only localhost is available
    warnings.warn("provided hosts list is empty, only localhost is available")

-- Docs: https://docs.pytest.org/en/latest/warnings.html

With this fix, the warning is no longer displayed. Fixture localhost still works fine.

Type of change

  • Bug fix
  • Testbed and Framework(new/improvement)
  • Test case(new/improvement)

Approach

How did you do it?

Remove the "inventory='localhost'" argument when calling the ansible_adhoc fixture to create a localhost ansible object. The inventory supplied in pytest cli argument will be used.

How did you verify/test it?

Test run scripts depend on the localhost fixture. The localhost fixture works fine. The warning is not displayed.

Any platform specific information?

Supported testbed topology if it's a new test case?

Documentation

Signed-off-by: Xin Wang <xiwang5@microsoft.com>
@wangxin wangxin requested a review from daall May 26, 2020 02:16
Copy link
Copy Markdown
Contributor

@daall daall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, Xin!

@daall daall merged commit 0334657 into sonic-net:master May 27, 2020
@wangxin wangxin deleted the localhost-inventory-warning branch June 28, 2020 10:27
shlomibitton pushed a commit to Junchao-Mellanox/sonic-mgmt that referenced this pull request Jul 12, 2020
commit 0334657
Author: Xin Wang <xiwang5@microsoft.com>
Date:   Wed May 27 09:28:17 2020 +0800

    Fix warning "provided hosts list is empty, only localhost is available" (sonic-net#1700)

    Signed-off-by: Xin Wang <xiwang5@microsoft.com>

commit 2786c57
Author: Stephen Sun <5379172+stephenxs@users.noreply.github.com>
Date:   Wed May 27 02:03:40 2020 +0800

    [QoS] Support designating the packet size when testing water mark of shared buffer (sonic-net#1663)

    * [qos] Support designating the packet size when testing water mark of shared buffer

Change-Id: I9464564494f454bad2fe5aedea5305524ed179e2
Signed-off-by: Stepan Blyschak <stepanb@mellanox.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants