Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add skip test logic when pika not installed #3057

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

bonicim
Copy link
Collaborator

@bonicim bonicim commented Nov 10, 2022

Description

Some tests require RMQ to be installed which in turn requires pika. When running these tests, pytest will mark those tests as 'ERROR'. If a volttron platform does not install RMQ, then running tests should not result in 'ERROR'; instead, those tests should be skipped following the example in this previous PR.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

pytest -m vc
pytest -m vcp
pytest -m zmq
pytest -m driver

Test Configuration:
Ubuntu 18.04
Python 3.10

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@bonicim
Copy link
Collaborator Author

bonicim commented Nov 10, 2022

@schandrika Do these test modifications make sense to you? The intent is for these tests to skip rather than thrown an error if pika is not installed (i.e. RMQ configured on Volttron).

if is_rabbitmq_available():
from volttrontesting.platform.test_instance_setup import create_vcfg_vhome
else:
pytest.skip("Pika is not installed", allow_module_level=True)
Copy link
Contributor

Choose a reason for hiding this comment

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

the create_vcfg_vhome method seem to be create a volttron home and nothing else. (The method should be name create_vhome )So I don't see why it should depend on pika install

HAS_RMQ = is_rabbitmq_available()
if HAS_RMQ:
from volttrontesting.fixtures.rmq_test_setup import create_rmq_volttron_setup
else:
Copy link
Contributor

Choose a reason for hiding this comment

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

The if part makes sense but in the else why should the entire module be skipped. The module has both rmq and zmq tests.

if is_rabbitmq_available():
from volttron.utils.rmq_setup import start_rabbit, stop_rabbit
else:
pytest.skip("Pika is not installed", allow_module_level=True)
Copy link
Contributor

Choose a reason for hiding this comment

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

Again, only the rmq test cases should be skipped. you can set a variable inside if and use that to skip the rmq test case alone

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.

2 participants