eclipse-volttron / volttron-testing

Other
0 stars 5 forks source link

volttron_instance fixture cleanup happens before completion of test module fixture cleanup #42

Open schandrika opened 1 year ago

schandrika commented 1 year ago

Describe the bug

A test modules final cleanup method in its module level fixture fails when -

  1. test module's fixture use volttron_instance fixture and
  2. also does a bunch of agent stop and remove in its own fixture's cleanup method

test module's fixture fails at agent uninstall or agent remove with Remote Error "volttron instance is not running" . This happens because volttron_instance fixture's cleanup method is called before the completion of test module fixture

To Reproduce Steps to reproduce the behavior:

  1. Create test, say, test_fixture_cleanup.py
  2. Create module level fixture, say test_fixture, that
    • uses volttrontesting.fixtures.volttron_platform_fixtures.volttron_instance fixture as an argument.
    • installs any two volttron agent in this volttron_instance
    • yields the agent id
    • add a cleanup logic - call volttron_instance.stop_agent(agent1), volttron_instance.stop_agent(agent2), volttron_instance.remove_agent(agent1), volttron_instance.remove_agent(agent2)
    • create a dummy test method that has module level fixture, test_fixture, as input
    • Run the test module

Expected behavior Test and cleanup should finish successfully. Agents should get installed before the start of the test, test method should pass, agents should get stopped and uninstalled successfully in the test_fixture's cleanup part, and only after this volttron_instance fixture's cleanup should get called. volttron_instance fixture's cleanup should shutdown volttron_instance